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
December 2012
- 2 participants
- 109 discussions
r34 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table
by tchemit@users.forge.codelutin.com 07 Dec '12
by tchemit@users.forge.codelutin.com 07 Dec '12
07 Dec '12
Author: tchemit
Date: 2012-12-07 15:48:55 +0100 (Fri, 07 Dec 2012)
New Revision: 34
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/34
Log:
add missing svn properties
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2012-12-07 14:48:14 UTC (rev 33)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2012-12-07 14:48:55 UTC (rev 34)
@@ -4,7 +4,7 @@
* #%L
* Tutti :: UI
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2012 Ifremer
* %%
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
1
0
r33 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing 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/util/table resources/i18n resources/icons
by tchemit@users.forge.codelutin.com 07 Dec '12
by tchemit@users.forge.codelutin.com 07 Dec '12
07 Dec '12
Author: tchemit
Date: 2012-12-07 15:48:14 +0100 (Fri, 07 Dec 2012)
New Revision: 33
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/33
Log:
saisie des mensurations + am?\195?\169lioration api table
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java
trunk/tutti-ui-swing/src/main/resources/icons/action-close.png
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java
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/content/catches/species/FrequencyCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.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/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java
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/catches/species/frequency/SpeciesFrequencyTableModel.java
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/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/util/table/AbstractSelectTableAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.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/AbstractTuttiTableUIModel.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -322,8 +322,8 @@
String surveyId = context.getSurveyId();
String campaignId = context.getCampaignId();
- JComponent screenUI = null;
- String screenTitle = null;
+ JComponent screenUI;
+ String screenTitle;
switch (screen) {
default:
Modified: 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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -25,8 +25,9 @@
*/
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.content.catches.species.frequency.SpeciesFrequencyUI;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -87,6 +88,8 @@
protected Frame frame;
+ protected JTable table;
+
protected SpeciesBatchTableModel tableModel;
protected SpeciesBatchColumnIdentifier columnIdentifier;
@@ -95,6 +98,8 @@
protected Integer rowIndex;
+ protected Integer columnIndex;
+
public FrequencyCellEditor(SpeciesFrequencyUI ui) {
this.ui = ui;
component = new FrequencyCellComponent();
@@ -125,8 +130,7 @@
// open frequency dialog
- Preconditions.checkNotNull(editRow,
- "No editRow found.");
+ Preconditions.checkNotNull(editRow, "No editRow found.");
if (log.isInfoEnabled()) {
log.info("Will edit frequencies for row: " + rowIndex);
@@ -138,8 +142,21 @@
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
@@ -150,7 +167,7 @@
int column) {
if (tableModel == null) {
tableModel = (SpeciesBatchTableModel) table.getModel();
-
+ this.table = table;
columnIdentifier = tableModel.getPropertyName(column);
}
String text;
@@ -162,6 +179,7 @@
component.setText(text);
rowIndex = row;
+ columnIndex = column;
editRow = tableModel.getEntry(row);
@@ -173,9 +191,6 @@
Preconditions.checkNotNull(editRow, "No editRow found in editor.");
- // update from computed frequencies
- editRow.updateTotalFromFrequencies();
-
Object result;
if (columnIdentifier == SpeciesBatchColumnIdentifier.computedNumber) {
result = editRow.getComputedNumber();
@@ -195,6 +210,7 @@
if (b) {
rowIndex = null;
editRow = null;
+ columnIndex = null;
}
return b;
}
@@ -203,6 +219,7 @@
public void cancelCellEditing() {
super.cancelCellEditing();
rowIndex = null;
+ columnIndex = null;
editRow = null;
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java 2012-12-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -25,7 +25,7 @@
*/
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractColumnIdentifier;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import static org.nuiton.i18n.I18n.n_;
@@ -33,7 +33,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public enum SpeciesBatchColumnIdentifier implements AbstractColumnIdentifier<SpeciesBatchRowModel> {
+public enum SpeciesBatchColumnIdentifier implements ColumnIdentifier<SpeciesBatchRowModel> {
speciesToConfirm(
n_("tutti.table.species.batch.header.toConfirm"),
Modified: 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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -192,12 +192,9 @@
List<SpeciesBatchFrequency> frequencies) {
this();
fromBean(aBatch);
-
- for (SpeciesBatchFrequency frequencyBean : frequencies) {
- SpeciesFrequencyRowModel f = new SpeciesFrequencyRowModel();
- f.fromBean(frequencyBean);
- frequency.add(f);
- }
+ List<SpeciesFrequencyRowModel> frequencyRows =
+ SpeciesFrequencyRowModel.fromBeans(frequencies);
+ frequency.addAll(frequencyRows);
updateTotalFromFrequencies();
}
@@ -209,7 +206,16 @@
totalWeight = 0f;
for (SpeciesFrequencyRowModel frequencyModel : frequency) {
totalNumber += frequencyModel.getNumber();
- totalWeight += frequencyModel.getComputedWeight();
+ 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;
+ }
}
}
Modified: 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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -84,6 +84,17 @@
SpeciesBatchColumnIdentifier.speciesByCode,
SpeciesBatchColumnIdentifier.computedNumber,
SpeciesBatchColumnIdentifier.computedWeight);
+ } else if (propertyName == SpeciesBatchColumnIdentifier.computedNumber) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SpeciesBatchColumnIdentifier.computedWeight);
+
+ } else if (propertyName == SpeciesBatchColumnIdentifier.computedWeight) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SpeciesBatchColumnIdentifier.computedNumber);
}
}
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -36,9 +36,11 @@
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.CatchesUI;
+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.content.catches.CatchesUI;
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;
@@ -80,7 +82,8 @@
SpeciesBatchRowModel.PROPERTY_WEIGHT,
SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
SpeciesBatchRowModel.PROPERTY_ELEVATION_RATIO,
- SpeciesBatchRowModel.PROPERTY_COMMENT);
+ SpeciesBatchRowModel.PROPERTY_COMMENT,
+ SpeciesBatchRowModel.PROPERTY_FREQUENCY);
this.ui = ui;
this.parentUi = parentUi;
this.persistenceService = context.getService(PersistenceService.class);
@@ -138,6 +141,9 @@
// save when row chaged and was modified
listenRowModification(table);
+
+ // always scroll to selected row
+ SwingUtil.scrollToTableSelection(getTable());
}
@Override
@@ -161,6 +167,22 @@
} 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 selectTrait(Trait bean) {
@@ -304,8 +326,7 @@
addFloatColumnToModel(columnModel,
SpeciesBatchColumnIdentifier.maturity,
- TuttiUI.DECIMAL3_PATTERN
- );
+ TuttiUI.DECIMAL3_PATTERN);
}
{ // Age
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java 2012-12-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -25,7 +25,7 @@
*/
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractColumnIdentifier;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import static org.nuiton.i18n.I18n.n_;
@@ -33,7 +33,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public enum SpeciesFrequencyColumnIdentifier implements AbstractColumnIdentifier<SpeciesFrequencyRowModel> {
+public enum SpeciesFrequencyColumnIdentifier implements ColumnIdentifier<SpeciesFrequencyRowModel> {
lengthStep(
n_("tutti.table.species.frequency.header.lengthStep"),
Modified: 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/catches/species/frequency/SpeciesFrequencyRowModel.java 2012-12-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -24,11 +24,15 @@
* #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.ui.swing.AbstractTuttiBeanUIModel;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
+import java.util.List;
+
/**
* Represents a batch frequency row.
*
@@ -83,6 +87,27 @@
BinderFactory.newBinder(SpeciesFrequencyRowModel.class,
SpeciesBatchFrequency.class);
+ 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);
}
@@ -126,4 +151,10 @@
this.computedWeight = computedWeight;
firePropertyChange(PROPERTY_COMPUTED_WEIGHT, oldValue, computedWeight);
}
+
+ //TODO Use validator
+ @Override
+ public boolean isValid() {
+ return lengthStep != null && number != null;
+ }
}
Modified: 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/catches/species/frequency/SpeciesFrequencyTableModel.java 2012-12-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -24,9 +24,13 @@
* #L%
*/
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import javax.swing.table.TableColumnModel;
+import java.util.List;
+import java.util.Map;
/**
* Model of the species frequency table.
@@ -38,15 +42,34 @@
private static final long serialVersionUID = 1L;
- public SpeciesFrequencyTableModel(TableColumnModel columnModel) {
+ 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(SpeciesFrequencyColumnIdentifier.computedWeight);
}
@Override
protected SpeciesFrequencyRowModel createNewRow() {
- return new SpeciesFrequencyRowModel();
+ 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
@@ -58,4 +81,41 @@
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
Modified: 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/catches/species/frequency/SpeciesFrequencyUI.css 2012-12-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css 2012-12-07 14:48:14 UTC (rev 33)
@@ -21,24 +21,122 @@
* <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-lengthSteps";
+ text: "tutti.action.generate";
+ enabled: {model.isCanGenerate()};
+}
+
#configurationPanel {
- border:{new TitledBorder(null, _("tutti.label.frequencyConfiguration"))};
+ border: {new TitledBorder(null, _("tutti.legend.frequencyConfiguration"))};
}
-#saveButton {
- actionIcon:"save";
- text:"tutti.action.save";
- enabled:{model.isModify() && model.isValid()};
+#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";
+ actionIcon: "close";
+ text: "tutti.action.close";
}
#table {
- selectionMode:{ListSelectionModel.SINGLE_SELECTION};
- selectionBackground:{null};
- selectionForeground:{Color.BLACK};
- sortable:false;
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
}
\ No newline at end of file
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx 2012-12-07 14:48:14 UTC (rev 33)
@@ -28,18 +28,20 @@
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.catches.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[
@@ -65,16 +67,93 @@
<SpeciesFrequencyUIModel id='model'
initializer='getContextValue(SpeciesFrequencyUIModel.class)'/>
- <JPanel id='configurationPanel' constraints='BorderLayout.NORTH'
- layout='{new BorderLayout()}'>
+ <CardLayout2Ext id='modeConfigurationLayout'
+ constructorParams='this, "modeConfigurationPanel"'/>
- <JPanel id='configurationModePanel' constraints='BorderLayout.WEST'>
+ <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>
-
-
- </JPanel>
<JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
<JXTable id='table'/>
</JScrollPane>
@@ -82,7 +161,7 @@
<!-- actions -->
<JPanel id='actionPanel' layout='{new GridLayout(1, 0)}'
constraints='BorderLayout.SOUTH'>
- <JButton id='close' onActionPerformed='handler.close()'/>
+ <JButton id='closeButton' onActionPerformed='handler.close()'/>
</JPanel>
</JPanel>
\ No newline at end of file
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -24,12 +24,14 @@
* #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.content.catches.species.SpeciesBatchRowModel;
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;
@@ -39,6 +41,11 @@
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>
@@ -71,17 +78,6 @@
}
@Override
- protected void saveRow(SpeciesFrequencyRowModel row) {
-
- //TODO
- }
-
- @Override
- protected JXTable getTable() {
- return ui.getTable();
- }
-
- @Override
public void afterInitUI() {
initUI(ui);
@@ -91,9 +87,11 @@
// create table column model
TableColumnModel columnModel = createTableColumnModel(table);
+ SpeciesFrequencyUIModel model = getModel();
+
// create table model
SpeciesFrequencyTableModel tableModel =
- new SpeciesFrequencyTableModel(columnModel);
+ new SpeciesFrequencyTableModel(columnModel, model);
table.setModel(tableModel);
table.setColumnModel(columnModel);
@@ -102,31 +100,159 @@
table.getTableHeader().setReorderingAllowed(false);
- table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
+ 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);
+
+ //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() {
-// ui.getValidator().setBean(null);
}
@Override
+ protected void saveRow(SpeciesFrequencyRowModel row) {
+
+ // No persistence save from this screen
+ Float lengthStep = row.getLengthStep();
+ if (log.isInfoEnabled()) {
+ log.info("Add row " + lengthStep + " to cache");
+ }
+
+ if (lengthStep != null) {
+
+ // add it to cache
+
+ }
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
protected SpeciesFrequencyUIModel getModel() {
return ui.getModel();
}
+ 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();
+ Map<Float, SpeciesFrequencyRowModel> rowsByStep = getTableModel().getRowCache();
+
+ float aroundLengthStep = model.getLengthStep(step);
+
+ SpeciesFrequencyRowModel row = rowsByStep.get(aroundLengthStep);
+
+ if (row != null) {
+
+ // increments current row
+ Integer number = row.getNumber();
+ row.setNumber((number == null ? 0 : number) + 1);
+ getTableModel().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);
+
+ int indexRow = steps.indexOf(aroundLengthStep);
+
+ getTableModel().addNewRow(indexRow, row);
+ }
+ }
+
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 row: " + row);
+ log.info("Will edit batch row: " + row + " with " +
+ editFrequency.size() + " frequency");
}
- getModel().fromBean(row);
+ getModel().setRows(editFrequency);
+
+ // keep batch (will be used to push back editing entry)
+ getModel().setBatch(row);
}
public void close() {
@@ -135,6 +261,25 @@
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);
@@ -149,7 +294,7 @@
addFloatColumnToModel(columnModel,
SpeciesFrequencyColumnIdentifier.lengthStep,
- TuttiUI.DECIMAL3_PATTERN);
+ TuttiUI.DECIMAL1_PATTERN);
}
{ // Number
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -26,11 +26,7 @@
import fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderModelBuilder;
-import static org.nuiton.i18n.I18n.n_;
-
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
@@ -39,49 +35,65 @@
private static final long serialVersionUID = 1L;
- protected static final Binder<SpeciesBatchRowModel, SpeciesFrequencyUIModel> fromBeanBinder =
- BinderModelBuilder.newEmptyBuilder(SpeciesBatchRowModel.class, SpeciesFrequencyUIModel.class)
- .addProperty(SpeciesBatchRowModel.PROPERTY_FREQUENCY, PROPERTY_ROWS)
- .toBinder();
+ public static final String PROPERTY_CONFIGURATION_MODE = "configurationMode";
- protected static final Binder<SpeciesFrequencyUIModel, SpeciesBatchRowModel> toBeanBinder =
- BinderModelBuilder.newEmptyBuilder(SpeciesFrequencyUIModel.class, SpeciesBatchRowModel.class)
- .addProperty(PROPERTY_ROWS, SpeciesBatchRowModel.PROPERTY_FREQUENCY)
- .toBinder();
+ public static final String PROPERTY_STEP = "step";
- public static final String PROPERTY_CONFIGURATION_MODE = "configurationMode";
+ private static final String PROPERTY_MIN_STEP = "minStep";
- public static enum ConfigurationMode {
+ private static final String PROPERTY_MAX_STEP = "maxStep";
- SIMPLE(n_("tutti.speciesFrequency.configurationMode.simple"),
- n_("tutti.speciesFrequency.configurationMode.simple.tip")),
- AUTO_GEN(n_("tutti.speciesFrequency.configurationMode.autoGenerate"),
- n_("tutti.speciesFrequency.configurationMode.autoGenerate.tip")),
- RAFALE(n_("tutti.speciesFrequency.configurationMode.rafale"),
- n_("tutti.speciesFrequency.configurationMode.rafale.tip"));
+ public static final String PROPERTY_CAN_GENERATE = "canGenerate";
- private final String i18nKey;
+ public static final String PROPERTY_SIMPLE_MODE = "simpleMode";
- private final String tipKey;
+ public static final String PROPERTY_AUTO_GEN_MODE = "autoGenMode";
- private ConfigurationMode(String i18nKey, String tipKey) {
- this.i18nKey = i18nKey;
- this.tipKey = tipKey;
- }
+ public static final String PROPERTY_RAFALE_MODE = "rafaleMode";
- public String getI18nKey() {
- return i18nKey;
- }
-
- public String getTipKey() {
- return tipKey;
- }
+ 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, fromBeanBinder, toBeanBinder);
+ super(SpeciesBatchRowModel.class, null, null);
}
public ConfigurationMode getConfigurationMode() {
@@ -92,6 +104,72 @@
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
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java 2012-12-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -1,44 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util.table;
-
-/*
- * #%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 java.io.Serializable;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public interface AbstractColumnIdentifier<R> extends Serializable {
-
- String getPropertyName();
-
- String getHeaderI18nKey();
-
- String getHeaderTipI18nKey();
-
- void setValue(R entry, Object value);
-
- Object getValue(R entry);
-}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java 2012-12-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -53,16 +53,20 @@
this.table = table;
}
+ public static void doSelectCell(JTable table, int rowIndex, int columnIndex) {
+
+ table.setColumnSelectionInterval(columnIndex, columnIndex);
+ table.setRowSelectionInterval(rowIndex, rowIndex);
+ table.editCellAt(rowIndex, columnIndex);
+ }
+
protected void doSelectCell(int rowIndex, int columnIndex) {
if (log.isDebugEnabled()) {
log.debug("Will select cell at " +
getCellCoordinate(rowIndex, columnIndex));
}
-
- table.editCellAt(rowIndex, columnIndex);
- table.setColumnSelectionInterval(columnIndex, columnIndex);
- table.setRowSelectionInterval(rowIndex, rowIndex);
+ doSelectCell(table, rowIndex, columnIndex);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java 2012-12-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -44,7 +44,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public abstract class AbstractTuttiTableModel<R extends Serializable, C extends AbstractColumnIdentifier<R>> extends AbstractTableModel {
+public abstract class AbstractTuttiTableModel<R extends Serializable, C extends ColumnIdentifier<R>> extends AbstractTableModel {
private static final long serialVersionUID = 1L;
@@ -111,20 +111,47 @@
log.info("Set " + data.size() + " row(s) in table model " + this);
}
this.rows = data;
+ onRowsChanged(data);
fireTableDataChanged();
}
public final void addNewRow() {
R newValue = createNewRow();
+ addNewRow(getRowCount(), newValue);
+ }
+ public final void addNewRow(int rowIndex, R newValue) {
+
+ Preconditions.checkNotNull(newValue, "Row can not be null.");
+
List<R> data = getRows();
Preconditions.checkNotNull(data, "Data list can not be null.");
- data.add(newValue);
- int rowIndex = data.indexOf(newValue);
+ data.add(rowIndex, newValue);
+
+ onRowAdded(rowIndex, newValue);
fireTableRowsInserted(rowIndex, rowIndex);
}
+ public void updateRow(R row) {
+ Preconditions.checkNotNull(row, "Row can not be null.");
+
+ List<R> data = getRows();
+ Preconditions.checkNotNull(data, "Data list can not be null.");
+
+ int rowIndex = data.indexOf(row);
+
+ fireTableRowsUpdated(rowIndex, rowIndex);
+ }
+
+ protected void onRowsChanged(List<R> data) {
+ // by default do nothing
+ }
+
+ protected void onRowAdded(int rowIndex, R newValue) {
+ // by default do nothing
+ }
+
public final C getPropertyName(int columnIndex) {
TableColumn column = getColumn(columnIndex);
return (C) column.getIdentifier();
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -69,7 +69,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIModel, C extends AbstractColumnIdentifier<R>, T extends AbstractTuttiTableModel<R, C>, M extends AbstractTuttiTableUIModel<?, R, M>> extends AbstractTuttiUIHandler<M> {
+public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIModel, C extends ColumnIdentifier<R>, T extends AbstractTuttiTableModel<R, C>, M extends AbstractTuttiTableUIModel<?, R, M>> extends AbstractTuttiUIHandler<M> {
/** Logger. */
private static final Log log =
@@ -139,10 +139,10 @@
return keyAdapter;
}
- protected <C extends AbstractColumnIdentifier> void addColumnToModel(TableColumnModel model,
- TableCellEditor editor,
- TableCellRenderer renderer,
- C identifier) {
+ protected void addColumnToModel(TableColumnModel model,
+ TableCellEditor editor,
+ TableCellRenderer renderer,
+ ColumnIdentifier identifier) {
TableColumn col = new TableColumnExt(model.getColumnCount());
col.setCellEditor(editor);
@@ -154,15 +154,15 @@
model.addColumn(col);
}
- protected <C extends AbstractColumnIdentifier> void addColumnToModel(TableColumnModel model,
- C identifier) {
+ protected void addColumnToModel(TableColumnModel model,
+ ColumnIdentifier identifier) {
addColumnToModel(model, null, null, identifier);
}
- protected <C extends AbstractColumnIdentifier> void addFloatColumnToModel(TableColumnModel model,
- C identifier,
- String numberPattern) {
+ protected void addFloatColumnToModel(TableColumnModel model,
+ ColumnIdentifier identifier,
+ String numberPattern) {
NumberCellEditor<Float> editor =
JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
@@ -174,9 +174,9 @@
}
- protected <C extends AbstractColumnIdentifier> void addIntegerColumnToModel(TableColumnModel model,
- C identifier,
- String numberPattern) {
+ protected void addIntegerColumnToModel(TableColumnModel model,
+ ColumnIdentifier identifier,
+ String numberPattern) {
NumberCellEditor<Integer> editor =
JAXXWidgetUtil.newNumberTableCellEditor(Integer.class, false);
@@ -188,9 +188,9 @@
}
- protected <C extends AbstractColumnIdentifier> void addBooleanColumnToModel(TableColumnModel model,
- C identifier,
- JTable table) {
+ protected void addBooleanColumnToModel(TableColumnModel model,
+ ColumnIdentifier identifier,
+ JTable table) {
addColumnToModel(model,
table.getDefaultEditor(Boolean.class),
@@ -198,9 +198,9 @@
identifier);
}
- protected <C extends AbstractColumnIdentifier, B> void addComboDataColumnToModel(TableColumnModel model,
- C identifier,
- Decorator<B> decorator, List<B> data) {
+ protected <B> void addComboDataColumnToModel(TableColumnModel model,
+ ColumnIdentifier identifier,
+ Decorator<B> decorator, List<B> data) {
JComboBox comboBox = new JComboBox();
comboBox.setRenderer(newListCellRender(decorator));
SwingUtil.fillComboBox(comboBox, data, null);
@@ -215,9 +215,9 @@
identifier);
}
- protected <C extends AbstractColumnIdentifier, B extends Enum<B>> void addComboEnumColumnToModel(TableColumnModel model,
- C identifier,
- B[] data) {
+ protected <B extends Enum<B>> void addComboEnumColumnToModel(TableColumnModel model,
+ ColumnIdentifier identifier,
+ B[] data) {
EnumEditor<B> comboBox =
EnumEditor.newEditor(data);
BeanUIUtil.decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2012-12-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -42,7 +42,9 @@
protected List<R> rows;
- protected AbstractTuttiTableUIModel(Class<E> entityType, Binder<E, B> fromBeanBinder, Binder<B, E> toBeanBinder) {
+ protected AbstractTuttiTableUIModel(Class<E> entityType,
+ Binder<E, B> fromBeanBinder,
+ Binder<B, E> toBeanBinder) {
super(entityType, fromBeanBinder, toBeanBinder);
}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java (from rev 32, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -0,0 +1,44 @@
+package fr.ifremer.tutti.ui.swing.util.table;
+
+/*
+ * #%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 java.io.Serializable;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public interface ColumnIdentifier<R> extends Serializable {
+
+ String getPropertyName();
+
+ String getHeaderI18nKey();
+
+ String getHeaderTipI18nKey();
+
+ void setValue(R entry, Object value);
+
+ Object getValue(R entry);
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-07 14:48:14 UTC (rev 33)
@@ -5,6 +5,7 @@
tutti.action.cancel=Annuler
tutti.action.casino-import=Import Casino
tutti.action.catches=Captures
+tutti.action.close=Fermer
tutti.action.configuration=Configuration
tutti.action.configuration.tip=Configurer Tutti
tutti.action.edit=Editer
@@ -12,6 +13,7 @@
tutti.action.exit.tip=Quitter l'application
tutti.action.fillCatches=Captures
tutti.action.fillCatches.tip=Saisir des captures
+tutti.action.generate=Générer
tutti.action.manageProtocol=Protocole
tutti.action.manageProtocol.tip=Gérer les protocoles
tutti.action.new=Nouveau
@@ -47,7 +49,18 @@
tutti.label.captureAccidentel.sampleTotalWeight=Poids total échantillonné
tutti.label.captureAccidentel.totalWeight=Poids total
tutti.label.comment=Commentaire
-tutti.label.frequencyConfiguration=Mode de saisie
+tutti.label.frequencyConfiguration.maxStep=Classe max
+tutti.label.frequencyConfiguration.minStep=Classe min
+tutti.label.frequencyConfiguration.mode=Mode de saisie
+tutti.label.frequencyConfiguration.mode.autoGen=Génération des classes
+tutti.label.frequencyConfiguration.mode.autoGen.tip=Mode où toutes les classes de taille sont générées
+tutti.label.frequencyConfiguration.mode.rafale=Mode "rafale"
+tutti.label.frequencyConfiguration.mode.rafale.tip=Mode où on ne saisit uniquement la classe de taille (les nombres seront alors incrémentés...)
+tutti.label.frequencyConfiguration.mode.simple=Mode simple
+tutti.label.frequencyConfiguration.mode.simple.tip=Mode par défaut on on doit tout saisir (les classes de tailles et les nombres)
+tutti.label.frequencyConfiguration.no.configuration=< Pas de configuration >
+tutti.label.frequencyConfiguration.rafaleStep=Classe de taille à incrémenter
+tutti.label.frequencyConfiguration.step=Pas de la classe de taille
tutti.label.list.gear=Engin(s)
tutti.label.list.headOfMission=Chef(s) de mission
tutti.label.list.headOfSortRoom=Reponsable(s) de salle de tri
@@ -107,6 +120,7 @@
tutti.label.trait.traitRectiligne=Trait rectiligne
tutti.label.trait.traitValid=Trait valide
tutti.label.trait.windDirection=Direction du vent
+tutti.legend.frequencyConfiguration=Configuration
tutti.menu.actions=Actions
tutti.menu.actions.tip=Actions
tutti.menu.file=Fichier
@@ -121,12 +135,6 @@
tutti.menu.synchronisationImport.tip=Effectuer des imports
tutti.menu.synchronisations=Synchronisation
tutti.menu.synchronisations.tip=Import/Export
-tutti.speciesFrequency.configurationMode.autoGenerate=Génération des classes
-tutti.speciesFrequency.configurationMode.autoGenerate.tip=Mode où toutes les classes de taille sont générées
-tutti.speciesFrequency.configurationMode.rafale=Mode "rafale"
-tutti.speciesFrequency.configurationMode.rafale.tip=Mode où on ne saisit uniquement la classe de taille (les nombres seront alors incrémentés...)
-tutti.speciesFrequency.configurationMode.simple=Mode simple
-tutti.speciesFrequency.configurationMode.simple.tip=Mode par défaut on on doit tout saisir (les classes de tailles et les nombres)
tutti.table.benthos.header.number=Nombre observé
tutti.table.benthos.header.speciesByCode=Espèce
tutti.table.benthos.header.weight=Poids observé
Copied: trunk/tutti-ui-swing/src/main/resources/icons/action-close.png (from rev 32, trunk/tutti-ui-swing/src/main/resources/icons/action-exit.png)
===================================================================
(Binary files differ)
1
0
r32 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing 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/util resources/i18n
by tchemit@users.forge.codelutin.com 06 Dec '12
by tchemit@users.forge.codelutin.com 06 Dec '12
06 Dec '12
Author: tchemit
Date: 2012-12-06 18:43:45 +0100 (Thu, 06 Dec 2012)
New Revision: 32
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/32
Log:
display frequency ui + move ui util class to his natural package
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.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/MainUIHandler.java
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/SpeciesBatchColumnIdentifier.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/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/frequency/SpeciesFrequencyColumnIdentifier.java
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/catches/species/frequency/SpeciesFrequencyUI.css
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/resources/i18n/tutti-ui-swing_fr_FR.properties
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -31,6 +31,7 @@
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.swing.OneClicListSelectionModel;
import jaxx.runtime.swing.editor.NumberEditor;
import jaxx.runtime.swing.editor.TimeEditor;
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -34,6 +34,7 @@
import fr.ifremer.tutti.ui.swing.content.campaign.EditSurveyUI;
import fr.ifremer.tutti.ui.swing.content.campaign.SelectCampaignUI;
import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.AboutPanel;
import jaxx.runtime.swing.ErrorDialogUI;
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java 2012-12-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -1,257 +0,0 @@
-package fr.ifremer.tutti.ui.swing;
-
-/*
- * #%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.service.TuttiServiceTechnicalException;
-import fr.ifremer.tutti.ui.swing.util.TuttiColorHighlighter;
-import jaxx.runtime.JAXXUtil;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.decorator.HighlightPredicate;
-import org.jdesktop.swingx.decorator.Highlighter;
-import org.nuiton.util.FileUtil;
-
-import javax.swing.Action;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JRootPane;
-import javax.swing.KeyStroke;
-import javax.swing.UIManager;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.File;
-
-/**
- * Created: 14/06/12
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public final class TuttiUIUtil {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(TuttiUIUtil.class);
-
- private TuttiUIUtil() {
- // never instanciate util class
- }
-
- public static JDialog openInDialog(JComponent ui,
- JFrame frame,
- String title,
- Action closeAction) {
- return openInDialog(ui, frame, title, closeAction, null);
- }
-
- public static JDialog openInDialog(JComponent ui,
- JFrame frame,
- String title,
- Action closeAction,
- Dimension dim) {
-
- JDialog result = new JDialog(frame, false);
- result.setTitle(title);
- result.add(ui);
- result.setResizable(true);
- if (dim == null) {
- result.setSize(550, 450);
- } else {
- result.setSize(dim);
- }
- if (closeAction != null) {
- JRootPane rootPane = result.getRootPane();
- rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "close");
- rootPane.getActionMap().put("close", closeAction);
- }
- result.addWindowListener(new WindowAdapter() {
-
- @Override
- public void windowClosed(WindowEvent e) {
- Component ui = (Component) e.getSource();
- if (log.isInfoEnabled()) {
- log.info("Destroy ui " + ui);
- }
- JAXXUtil.destroy(ui);
- }
- });
- SwingUtil.center(frame, result);
- result.setVisible(true);
- return result;
- }
-
- /**
- * Choisir un fichier via un sélecteur graphique de fichiers.
- *
- * @param parent le component swing appelant le controle
- * @param title le titre du dialogue de sélection
- * @param buttonLabel le label du boutton d'acceptation
- * @param incoming le fichier de base à utilier
- * @param filters les filtres + descriptions sur le sélecteur de
- * fichiers
- * @return le fichier choisi ou le fichier incoming si l'opération a été
- * annulée
- */
- public static File chooseFile(Component parent,
- String title,
- String buttonLabel,
- File incoming,
- String... filters) {
- File oldBasedir = FileUtil.getCurrentDirectory();
- if (incoming != null) {
- File basedir;
- if (incoming.isFile()) {
- basedir = incoming.getParentFile();
- } else {
- basedir = incoming;
- }
- if (basedir.exists()) {
- FileUtil.setCurrentDirectory(basedir);
- }
- }
- File file = FileUtil.getFile(title, buttonLabel, parent, filters);
- if (log.isDebugEnabled()) {
- log.debug(title + " : " + file);
- }
- FileUtil.setCurrentDirectory(oldBasedir);
- File result = file == null ? incoming : file;
- return result;
- }
-
- /**
- * Choisir un répertoire via un sélecteur graphique de fichiers.
- *
- * @param parent le component swing appelant le controle
- * @param title le titre de la boite de dialogue de sléection
- * @param buttonLabel le label de l'action d'acceptation
- * @param incoming le fichier de base à utiliser
- * @return le répertoire choisi ou le répertoire incoming si l'opération a
- * été annulée
- */
- public static File chooseDirectory(Component parent,
- String title,
- String buttonLabel,
- File incoming) {
- File oldBasedir = FileUtil.getCurrentDirectory();
- if (incoming != null) {
- File basedir;
- if (incoming.isFile()) {
- basedir = incoming.getParentFile();
- } else {
- basedir = incoming;
- }
- if (basedir.exists()) {
- FileUtil.setCurrentDirectory(basedir);
- }
- }
- String file = FileUtil.getDirectory(parent, title, buttonLabel);
- if (log.isDebugEnabled()) {
- log.debug(title + " : " + file);
- }
- FileUtil.setCurrentDirectory(oldBasedir);
- return file == null ? incoming : new File(file);
- }
-
- public static void updateBusyState(Component ui, boolean busy) {
- if (busy) {
- // ui bloquee
- if (log.isDebugEnabled()) {
- log.debug("block ui in busy mode");
- }
- ui.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- } else {
- // ui debloquee
- if (log.isDebugEnabled()) {
- log.debug("unblock ui in none busy mode");
- }
- ui.setCursor(Cursor.getDefaultCursor());
- }
- }
-
- public static void showSuccessMessage(Component ui, String message) {
- JOptionPane.showMessageDialog(
- ui,
- message,
- "Success",
- JOptionPane.INFORMATION_MESSAGE,
- UIManager.getIcon("info")
- );
- }
-
- public static void showErrorMessage(Component ui, String message) {
- JOptionPane.showMessageDialog(
- ui,
- message,
- "Error",
- JOptionPane.ERROR_MESSAGE,
- UIManager.getIcon("error")
- );
- }
-
- public static boolean askQuestion(Component ui, String message) {
- int i = JOptionPane.showConfirmDialog(
- ui,
- message,
- "Question?",
- JOptionPane.YES_NO_OPTION);
- return i == JOptionPane.YES_OPTION;
- }
-
- public static void setProperty(Object bean, String property, Object value) {
- Preconditions.checkNotNull(bean);
- Preconditions.checkNotNull(property);
- try {
- PropertyUtils.setSimpleProperty(bean, property, value);
- } catch (Exception e) {
- throw new TuttiServiceTechnicalException("Could not set property '" + property + "' on object of type '" + bean.getClass().getName() + "'", e);
- }
- }
-
- public static Object getProperty(Object bean, String property) {
- Preconditions.checkNotNull(bean);
- Preconditions.checkNotNull(property);
- try {
- return PropertyUtils.getSimpleProperty(bean, property);
- } catch (Exception e) {
- throw new TuttiServiceTechnicalException("Could not get property '" + property + "' on object of type '" + bean.getClass().getName() + "'", e);
- }
- }
-
- public static Highlighter newBackgroundColorHighlighter(HighlightPredicate predicate, Color color) {
- return new TuttiColorHighlighter(predicate, color, false);
- }
-
- public static Highlighter newForegroundColorHighlighter(HighlightPredicate predicate, Color color) {
- return new TuttiColorHighlighter(predicate, color, true);
- }
-}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java 2012-12-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -25,6 +25,8 @@
*/
import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -37,11 +39,14 @@
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.
*
@@ -68,8 +73,8 @@
return new FrequencyCellRenderer();
}
- public static TableCellEditor newEditor() {
- return new FrequencyCellEditor();
+ public static TableCellEditor newEditor(SpeciesFrequencyUI ui) {
+ return new FrequencyCellEditor(ui);
}
public static class FrequencyCellEditor extends AbstractCellEditor implements TableCellEditor {
@@ -78,6 +83,10 @@
protected final FrequencyCellComponent component;
+ protected final SpeciesFrequencyUI ui;
+
+ protected Frame frame;
+
protected SpeciesBatchTableModel tableModel;
protected SpeciesBatchColumnIdentifier columnIdentifier;
@@ -86,7 +95,8 @@
protected Integer rowIndex;
- public FrequencyCellEditor() {
+ public FrequencyCellEditor(SpeciesFrequencyUI ui) {
+ this.ui = ui;
component = new FrequencyCellComponent();
component.setBorder(new LineBorder(Color.BLACK));
component.addKeyListener(new KeyAdapter() {
@@ -121,6 +131,15 @@
if (log.isInfoEnabled()) {
log.info("Will edit frequencies for row: " + rowIndex);
}
+
+ if (frame == null) {
+ frame = SwingUtil.getParentContainer(ui, Frame.class);
+ }
+
+ ui.editBatch(editRow);
+
+ TuttiUIUtil.openInDialog(ui, frame, _("tutti.title.frequency"), true, null);
+
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java 2012-12-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractColumnIdentifier;
import static org.nuiton.i18n.I18n.n_;
Modified: 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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -26,7 +26,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import java.io.Serializable;
import java.util.List;
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-06 17:43:45 UTC (rev 32)
@@ -29,6 +29,7 @@
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+ fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI
org.jdesktop.swingx.JXTable
@@ -73,6 +74,8 @@
<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 -->
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -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.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import org.apache.commons.logging.Log;
@@ -325,7 +325,7 @@
{ // Poids calculé
addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(),
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
FrequencyCellComponent.newRender(),
SpeciesBatchColumnIdentifier.computedWeight);
}
@@ -333,7 +333,7 @@
{ // Nombre calculé
addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(),
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
FrequencyCellComponent.newRender(),
SpeciesBatchColumnIdentifier.computedNumber);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java 2012-12-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractColumnIdentifier;
import static org.nuiton.i18n.I18n.n_;
Modified: 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/catches/species/frequency/SpeciesFrequencyTableModel.java 2012-12-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -41,7 +41,7 @@
public SpeciesFrequencyTableModel(TableColumnModel columnModel) {
super(columnModel);
- setNoneEditableCols(SpeciesFrequencyColumnIdentifier.weight);
+ setNoneEditableCols(SpeciesFrequencyColumnIdentifier.computedWeight);
}
@Override
Modified: 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/catches/species/frequency/SpeciesFrequencyUI.css 2012-12-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css 2012-12-06 17:43:45 UTC (rev 32)
@@ -31,9 +31,9 @@
enabled:{model.isModify() && model.isValid()};
}
-#cancelButton {
- actionIcon:"cancel";
- text:"tutti.action.cancel";
+#closeButton {
+ actionIcon:"close";
+ text:"tutti.action.close";
}
#table {
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx 2012-12-06 17:43:45 UTC (rev 32)
@@ -50,7 +50,10 @@
handler.beforeInitUI();
}
- public void editBatch(SpeciesBatchRowModel row) { handler.editBatch(row); }
+ public void editBatch(SpeciesBatchRowModel row) {
+ handler.editBatch(row);
+ }
+
protected void $afterCompleteSetup() {
handler.afterInitUI();
}
@@ -79,8 +82,7 @@
<!-- actions -->
<JPanel id='actionPanel' layout='{new GridLayout(1, 0)}'
constraints='BorderLayout.SOUTH'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ <JButton id='close' onActionPerformed='handler.close()'/>
</JPanel>
</JPanel>
\ No newline at end of file
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -24,18 +24,19 @@
* #L%
*/
-import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel;
+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 javax.swing.JDialog;
import javax.swing.table.TableColumnModel;
import java.awt.Color;
@@ -51,8 +52,6 @@
private final SpeciesFrequencyUI ui;
- private final PersistenceService persistenceService;
-
public SpeciesFrequencyUIHandler(TuttiUIContext context,
SpeciesFrequencyUI ui) {
super(context,
@@ -61,7 +60,6 @@
SpeciesFrequencyRowModel.PROPERTY_WEIGHT,
SpeciesFrequencyRowModel.PROPERTY_COMPUTED_WEIGHT);
this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
}
@Override
@@ -131,20 +129,15 @@
getModel().fromBean(row);
}
- public void cancel() {
- if (log.isInfoEnabled()) {
- log.info("Will cancel");
- }
- }
+ public void close() {
- public void save() {
-
if (log.isInfoEnabled()) {
- log.info("Will save");
+ log.info("Will close UI " + ui);
}
- SpeciesFrequencyUIModel model = getModel();
+ ui.editBatch(null);
+ SwingUtil.getParentContainer(ui, JDialog.class).setVisible(false);
}
@Override
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -0,0 +1,258 @@
+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 com.google.common.base.Preconditions;
+import fr.ifremer.tutti.service.TuttiServiceTechnicalException;
+import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+import org.nuiton.util.FileUtil;
+
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.JRootPane;
+import javax.swing.KeyStroke;
+import javax.swing.UIManager;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.File;
+
+/**
+ * Created: 14/06/12
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public final class TuttiUIUtil {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(TuttiUIUtil.class);
+
+ private TuttiUIUtil() {
+ // never instanciate util class
+ }
+
+ public static JDialog openInDialog(JComponent ui,
+ Frame frame,
+ String title,
+ boolean modal,
+ Action closeAction) {
+ return openInDialog(ui, frame, title, modal, closeAction, null);
+ }
+
+ public static JDialog openInDialog(JComponent ui,
+ Frame frame,
+ String title,
+ boolean modal,
+ Action closeAction,
+ Dimension dim) {
+
+ JDialog result = new JDialog(frame, modal);
+ result.setTitle(title);
+ result.add(ui);
+ result.setResizable(true);
+ if (dim == null) {
+ result.setSize(550, 450);
+ } else {
+ result.setSize(dim);
+ }
+ if (closeAction != null) {
+ JRootPane rootPane = result.getRootPane();
+ rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "close");
+ rootPane.getActionMap().put("close", closeAction);
+ }
+ result.addWindowListener(new WindowAdapter() {
+
+ @Override
+ public void windowClosed(WindowEvent e) {
+ Component ui = (Component) e.getSource();
+ if (log.isInfoEnabled()) {
+ log.info("Destroy ui " + ui);
+ }
+ JAXXUtil.destroy(ui);
+ }
+ });
+ SwingUtil.center(frame, result);
+ result.setVisible(true);
+ return result;
+ }
+
+ /**
+ * Choisir un fichier via un sélecteur graphique de fichiers.
+ *
+ * @param parent le component swing appelant le controle
+ * @param title le titre du dialogue de sélection
+ * @param buttonLabel le label du boutton d'acceptation
+ * @param incoming le fichier de base à utilier
+ * @param filters les filtres + descriptions sur le sélecteur de
+ * fichiers
+ * @return le fichier choisi ou le fichier incoming si l'opération a été
+ * annulée
+ */
+ public static File chooseFile(Component parent,
+ String title,
+ String buttonLabel,
+ File incoming,
+ String... filters) {
+ File oldBasedir = FileUtil.getCurrentDirectory();
+ if (incoming != null) {
+ File basedir;
+ if (incoming.isFile()) {
+ basedir = incoming.getParentFile();
+ } else {
+ basedir = incoming;
+ }
+ if (basedir.exists()) {
+ FileUtil.setCurrentDirectory(basedir);
+ }
+ }
+ File file = FileUtil.getFile(title, buttonLabel, parent, filters);
+ if (log.isDebugEnabled()) {
+ log.debug(title + " : " + file);
+ }
+ FileUtil.setCurrentDirectory(oldBasedir);
+ File result = file == null ? incoming : file;
+ return result;
+ }
+
+ /**
+ * Choisir un répertoire via un sélecteur graphique de fichiers.
+ *
+ * @param parent le component swing appelant le controle
+ * @param title le titre de la boite de dialogue de sléection
+ * @param buttonLabel le label de l'action d'acceptation
+ * @param incoming le fichier de base à utiliser
+ * @return le répertoire choisi ou le répertoire incoming si l'opération a
+ * été annulée
+ */
+ public static File chooseDirectory(Component parent,
+ String title,
+ String buttonLabel,
+ File incoming) {
+ File oldBasedir = FileUtil.getCurrentDirectory();
+ if (incoming != null) {
+ File basedir;
+ if (incoming.isFile()) {
+ basedir = incoming.getParentFile();
+ } else {
+ basedir = incoming;
+ }
+ if (basedir.exists()) {
+ FileUtil.setCurrentDirectory(basedir);
+ }
+ }
+ String file = FileUtil.getDirectory(parent, title, buttonLabel);
+ if (log.isDebugEnabled()) {
+ log.debug(title + " : " + file);
+ }
+ FileUtil.setCurrentDirectory(oldBasedir);
+ return file == null ? incoming : new File(file);
+ }
+
+ public static void updateBusyState(Component ui, boolean busy) {
+ if (busy) {
+ // ui bloquee
+ if (log.isDebugEnabled()) {
+ log.debug("block ui in busy mode");
+ }
+ ui.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ } else {
+ // ui debloquee
+ if (log.isDebugEnabled()) {
+ log.debug("unblock ui in none busy mode");
+ }
+ ui.setCursor(Cursor.getDefaultCursor());
+ }
+ }
+
+ public static void showSuccessMessage(Component ui, String message) {
+ JOptionPane.showMessageDialog(
+ ui,
+ message,
+ "Success",
+ JOptionPane.INFORMATION_MESSAGE,
+ UIManager.getIcon("info")
+ );
+ }
+
+ public static void showErrorMessage(Component ui, String message) {
+ JOptionPane.showMessageDialog(
+ ui,
+ message,
+ "Error",
+ JOptionPane.ERROR_MESSAGE,
+ UIManager.getIcon("error")
+ );
+ }
+
+ public static boolean askQuestion(Component ui, String message) {
+ int i = JOptionPane.showConfirmDialog(
+ ui,
+ message,
+ "Question?",
+ JOptionPane.YES_NO_OPTION);
+ return i == JOptionPane.YES_OPTION;
+ }
+
+ public static void setProperty(Object bean, String property, Object value) {
+ Preconditions.checkNotNull(bean);
+ Preconditions.checkNotNull(property);
+ try {
+ PropertyUtils.setSimpleProperty(bean, property, value);
+ } catch (Exception e) {
+ throw new TuttiServiceTechnicalException("Could not set property '" + property + "' on object of type '" + bean.getClass().getName() + "'", e);
+ }
+ }
+
+ public static Object getProperty(Object bean, String property) {
+ Preconditions.checkNotNull(bean);
+ Preconditions.checkNotNull(property);
+ try {
+ return PropertyUtils.getSimpleProperty(bean, property);
+ } catch (Exception e) {
+ throw new TuttiServiceTechnicalException("Could not get property '" + property + "' on object of type '" + bean.getClass().getName() + "'", e);
+ }
+ }
+
+ public static Highlighter newBackgroundColorHighlighter(HighlightPredicate predicate, Color color) {
+ return new TuttiColorHighlighter(predicate, color, false);
+ }
+
+ public static Highlighter newForegroundColorHighlighter(HighlightPredicate predicate, Color color) {
+ return new TuttiColorHighlighter(predicate, color, true);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-06 17:43:45 UTC (rev 32)
@@ -164,6 +164,7 @@
tutti.title.edit.campaign=Editer une campagne existante
tutti.title.edit.survey=Editer une série de 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.noSelectedCampaign=Pas de campagne sélectionné
tutti.title.noSelectedSurvey=Pas de série de campagne sélectionné
1
0
r31 - in trunk: tutti-service/src/main/java/fr/ifremer/tutti/service tutti-service/src/main/resources/i18n tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species tutti-ui-swing/src/main/resources/i18n
by tchemit@users.forge.codelutin.com 06 Dec '12
by tchemit@users.forge.codelutin.com 06 Dec '12
06 Dec '12
Author: tchemit
Date: 2012-12-06 18:16:09 +0100 (Thu, 06 Dec 2012)
New Revision: 31
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/31
Log:
optimize i18n
Modified:
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/content/catches/species/SpeciesTabUI.css
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
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-06 17:03:05 UTC (rev 30)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-06 17:16:09 UTC (rev 31)
@@ -286,7 +286,6 @@
//-- Species Batch methods --//
//------------------------------------------------------------------------//
-
@Override
public List<SpeciesBatch> getAllSpeciesBatch(String traitId) {
checkDriverExists();
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-06 17:03:05 UTC (rev 30)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-12-06 17:16:09 UTC (rev 31)
@@ -3,29 +3,20 @@
tutti.config.data.directory=Répertoire de données de l'application. Vous pouvez utiliser l'expression ${tutti.data.directory} pour le référence dans d'autres propriétés de configuration (ex\: ${tutti.data.directory}/tmp).
tutti.config.license.organizationName=Nom de l'organisation dans la licence
tutti.config.tmp.directory=Répertoire temporaire utilisée par l'application (est nettoyé à chaque démarrage de l'application)
-tutti.property.beaufortScale=
-tutti.property.beaufortScaleBean=Vent beaufort
-tutti.property.campaign=
-tutti.property.campaignBean=Campagne
+tutti.property.beaufortScale=Vent beaufort
+tutti.property.campaign=Campagne
tutti.property.codeMemo=Code Memo
-tutti.property.country=
-tutti.property.countryBean=Pays
+tutti.property.country=Pays
tutti.property.date=Date
-tutti.property.gear=
-tutti.property.gearBean=Engin
+tutti.property.gear=Engin
tutti.property.genusSpecies=Nom scientifique
tutti.property.name=Nom
-tutti.property.seaState=
-tutti.property.seaStateBean=État de la mer
+tutti.property.seaState=État de la mer
tutti.property.stationNumber=Numéro de station
tutti.property.strata=Strate d'association
-tutti.property.survey=
-tutti.property.surveyBean=Série de campagne
+tutti.property.survey=Série de campagne
tutti.property.trait=Trait
-tutti.property.user=
-tutti.property.userBean=Utilisateur
-tutti.property.vessel=
-tutti.property.vesselBean=Navire
-tutti.property.zone=
-tutti.property.zoneBean=Zone
+tutti.property.user=Utilisateur
+tutti.property.vessel=Navire
+tutti.property.zone=Zone
tutti.service.config=Configuration des services de Tutti
Modified: 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-06 17:03:05 UTC (rev 30)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css 2012-12-06 17:16:09 UTC (rev 31)
@@ -30,7 +30,7 @@
}
#totalWeightLabel {
- text:"tutti.label.fishes.totalWeight";
+ text:"tutti.label.species.totalWeight";
labelFor:{totalWeightField};
}
@@ -42,7 +42,7 @@
}
#totalVracWeightLabel {
- text:"tutti.label.fishes.totalVracWeight";
+ text:"tutti.label.species.totalVracWeight";
labelFor:{totalVracWeightField};
}
@@ -54,7 +54,7 @@
}
#sampleVracWeightLabel {
- text:"tutti.label.fishes.sampleVracWeight";
+ text:"tutti.label.species.sampleVracWeight";
labelFor:{sampleVracWeightField};
}
@@ -66,7 +66,7 @@
}
#totalHorsVracWeightLabel {
- text:"tutti.label.fishes.totalHorsVracWeight";
+ text:"tutti.label.species.totalHorsVracWeight";
labelFor:{totalHorsVracWeightField};
}
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-06 17:03:05 UTC (rev 30)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-06 17:16:09 UTC (rev 31)
@@ -37,7 +37,7 @@
tutti.config.ui.autoPopupNumberEditor=Toujours afficher le pavé numérique lors de l'édition d'un nombre
tutti.config.ui.config=Chemin du fichier de configuration des interfaces graphiques
tutti.config.ui.showNumberEditorButton=Afficher le pavé numérique de saisie
-tutti.label.benthos.sampleTotalWeight=Poids échantilloné
+tutti.label.benthos.sampleTotalWeight=Poids total échantillonné
tutti.label.benthos.totalWeight=Poids total
tutti.label.campaign=Campagne
tutti.label.campaign.country=Pays
@@ -47,11 +47,7 @@
tutti.label.captureAccidentel.sampleTotalWeight=Poids total échantillonné
tutti.label.captureAccidentel.totalWeight=Poids total
tutti.label.comment=Commentaire
-tutti.label.fishes.sampleVracWeight=Poids total vrac échant.
-tutti.label.fishes.totalHorsVracWeight=Poids total hors vrac
-tutti.label.fishes.totalVracWeight=Poids total vrac
-tutti.label.fishes.totalWeight=Poids total
-tutti.label.frequencyConfiguration=
+tutti.label.frequencyConfiguration=Mode de saisie
tutti.label.list.gear=Engin(s)
tutti.label.list.headOfMission=Chef(s) de mission
tutti.label.list.headOfSortRoom=Reponsable(s) de salle de tri
@@ -62,6 +58,10 @@
tutti.label.no.trait.selected=< Aucun trait sélectionné >
tutti.label.plancton.sampleTotalWeight=Poids total échantillonné
tutti.label.plancton.totalWeight=Poids total
+tutti.label.species.sampleVracWeight=Poids total vrac échant.
+tutti.label.species.totalHorsVracWeight=Poids total hors vrac
+tutti.label.species.totalVracWeight=Poids total vrac
+tutti.label.species.totalWeight=Poids total
tutti.label.survey=Série de campagne
tutti.label.survey.name=Nom
tutti.label.survey.zone=Zone
@@ -121,12 +121,12 @@
tutti.menu.synchronisationImport.tip=Effectuer des imports
tutti.menu.synchronisations=Synchronisation
tutti.menu.synchronisations.tip=Import/Export
-tutti.speciesFrequency.configurationMode.autoGenerate=
-tutti.speciesFrequency.configurationMode.autoGenerate.tip=
-tutti.speciesFrequency.configurationMode.rafale=
-tutti.speciesFrequency.configurationMode.rafale.tip=
-tutti.speciesFrequency.configurationMode.simple=
-tutti.speciesFrequency.configurationMode.simple.tip=
+tutti.speciesFrequency.configurationMode.autoGenerate=Génération des classes
+tutti.speciesFrequency.configurationMode.autoGenerate.tip=Mode où toutes les classes de taille sont générées
+tutti.speciesFrequency.configurationMode.rafale=Mode "rafale"
+tutti.speciesFrequency.configurationMode.rafale.tip=Mode où on ne saisit uniquement la classe de taille (les nombres seront alors incrémentés...)
+tutti.speciesFrequency.configurationMode.simple=Mode simple
+tutti.speciesFrequency.configurationMode.simple.tip=Mode par défaut on on doit tout saisir (les classes de tailles et les nombres)
tutti.table.benthos.header.number=Nombre observé
tutti.table.benthos.header.speciesByCode=Espèce
tutti.table.benthos.header.weight=Poids observé
1
0
06 Dec '12
Author: tchemit
Date: 2012-12-06 18:03:05 +0100 (Thu, 06 Dec 2012)
New Revision: 30
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/30
Log:
- rename entity (no more Ben suffix)
- introduce table ui api
- continue species batch frequencies ui
Added:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AbstractTraitBatch.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AccidentelBatch.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BenthosBatch.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Campaign.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/MacroDechetBatch.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/PlanctonBatch.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatch.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchFrequency.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Strata.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Survey.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Trait.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/TraitAware.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/VracHorsVracEnum.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScale.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Country.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Gear.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaState.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Sex.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Species.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TuttiUser.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Vessel.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategory.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Zone.java
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/SpeciesBatchColumnIdentifier.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/frequency/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java
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/catches/species/frequency/SpeciesFrequencyTableModel.java
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/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/util/table/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.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/AbstractTuttiTableUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableRowAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableCellAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableRowAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java
trunk/tutti-ui-swing/src/main/resources/icons/action-show-frequency.png
Removed:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java
trunk/tutti-persistence/src/main/resources/META-INF/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java
Modified:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfigOption.java
trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-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/AbstractTuttiBeanUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.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/content/campaign/EditCampaignUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.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/accidentel/AccidentelTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java
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/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,25 +24,26 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.StrataBean;
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
-import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
-import fr.ifremer.tutti.persistence.entities.referential.GearBean;
-import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
-import fr.ifremer.tutti.persistence.entities.referential.SexBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.persistence.entities.referential.UserBean;
-import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
-import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
+import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
+import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.data.Strata;
+import fr.ifremer.tutti.persistence.entities.data.Survey;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.SeaState;
+import fr.ifremer.tutti.persistence.entities.referential.Sex;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
+import fr.ifremer.tutti.persistence.entities.referential.Zone;
import org.nuiton.util.ApplicationConfig;
import java.io.Closeable;
@@ -57,72 +58,142 @@
*/
public interface TuttiPersistence extends Closeable {
+ //------------------------------------------------------------------------//
+ //-- Technical methods --//
+ //------------------------------------------------------------------------//
+
String getImplementationName();
void open(ApplicationConfig config) throws IOException;
void close() throws IOException;
- List<WeightCategoryBean> getAllWeightCategories();
+ //------------------------------------------------------------------------//
+ //-- Referential methods --//
+ //------------------------------------------------------------------------//
- List<SexBean> getAllSex();
+ List<WeightCategory> getAllWeightCategory();
- List<SpeciesBean> getAllSpecies();
+ List<Sex> getAllSex();
- List<SeaStateBean> getAllSeaStates();
+ List<Species> getAllSpecies();
- List<StrataBean> getAllStratas();
+ List<SeaState> getAllSeaState();
- List<BeaufortScaleBean> getAllBeaufortScales();
+ List<Strata> getAllStrata();
- List<SurveyBean> getAllSurveys();
+ List<BeaufortScale> getAllBeaufortScale();
- List<ZoneBean> getAllZones();
+ List<Zone> getAllZone();
- List<CountryBean> getAllCountries();
+ List<Country> getAllCountry();
- List<VesselBean> getAllVessels();
+ List<Vessel> getAllVessel();
- List<GearBean> getAllGears();
+ List<Gear> getAllGear();
- List<UserBean> getAllUsers();
+ List<TuttiUser> getAllTuttiUser();
- List<CampaignBean> getAllCampaigns(String surveyId);
+ //------------------------------------------------------------------------//
+ //-- Survey methods --//
+ //------------------------------------------------------------------------//
- List<TraitBean> getAllTraits(String campaignId);
+ List<Survey> getAllSurvey();
- List<TraitSpeciesCatchBean> getAllTraitSpeciesCatch(String traitId);
+ Survey getSurvey(String surveyId);
- List<TraitBenthosCatchBean> getAllTraitBenthosCatch(String traitId);
+ Survey createSurvey(Survey bean);
- List<TraitPlanctonCatchBean> getAllTraitPlanctonCatch(String traitId);
+ Survey saveSurvey(Survey bean);
- List<TraitMacroDechetCatchBean> getAllTraitMacroDechetCatch(String traitId);
+ //------------------------------------------------------------------------//
+ //-- Campaign methods --//
+ //------------------------------------------------------------------------//
- List<TraitCaptureAccidentelCatchBean> getAllTraitCaptureAccidentelCatch(String traitId);
+ List<Campaign> getAllCampaign(String surveyId);
- SurveyBean getSurvey(String surveyId);
+ Campaign getCampaign(String campaignId);
- CampaignBean getCampaign(String campaignId);
+ Campaign createCampaign(Campaign bean);
- TraitBean getTrait(String traitId);
+ Campaign saveCampaign(Campaign bean);
- TraitSpeciesCatchBean getTraitSpeciesCatch(String id);
+ //------------------------------------------------------------------------//
+ //-- Trait methods --//
+ //------------------------------------------------------------------------//
- SurveyBean createSurvey(SurveyBean bean);
+ List<Trait> getAllTrait(String campaignId);
- SurveyBean saveSurvey(SurveyBean bean);
+ Trait getTrait(String traitId);
- CampaignBean createCampaign(CampaignBean bean);
+ Trait createTrait(Trait bean);
- CampaignBean saveCampaign(CampaignBean bean);
+ Trait saveTrait(Trait bean);
- TraitBean createTrait(TraitBean bean);
+ //------------------------------------------------------------------------//
+ //-- Species Batch methods --//
+ //------------------------------------------------------------------------//
- TraitBean saveTrait(TraitBean bean);
+ List<SpeciesBatch> getAllSpeciesBatch(String traitId);
- TraitSpeciesCatchBean createTraitSpeciesCatch(TraitSpeciesCatchBean bean);
+ SpeciesBatch getSpeciesBatch(String id);
- TraitSpeciesCatchBean saveTraitSpeciesCatch(TraitSpeciesCatchBean bean);
+ SpeciesBatch createSpeciesBatch(SpeciesBatch bean);
+ SpeciesBatch saveSpeciesBatch(SpeciesBatch bean);
+
+ List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(
+ String speciesBatchId);
+
+ List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId,
+ List<SpeciesBatchFrequency> frequencies);
+
+ //------------------------------------------------------------------------//
+ //-- Benthos Batch methods --//
+ //------------------------------------------------------------------------//
+
+ List<BenthosBatch> getAllBenthosBatch(String traitId);
+
+ BenthosBatch getBenthosBatch(String id);
+
+ BenthosBatch createBenthosBatch(BenthosBatch bean);
+
+ BenthosBatch saveBenthosBatch(BenthosBatch bean);
+
+ //------------------------------------------------------------------------//
+ //-- Plancton Batch methods --//
+ //------------------------------------------------------------------------//
+
+ List<PlanctonBatch> getAllPlanctonBatch(String traitId);
+
+ PlanctonBatch getPlanctonBatch(String id);
+
+ PlanctonBatch createPlanctonBatch(PlanctonBatch bean);
+
+ PlanctonBatch savePlanctonBatch(PlanctonBatch bean);
+
+ //------------------------------------------------------------------------//
+ //-- Macrodechet Batch methods --//
+ //------------------------------------------------------------------------//
+
+ List<MacroDechetBatch> getAllMacroDechetBatch(String traitId);
+
+ MacroDechetBatch getMacroDechetBatch(String id);
+
+ MacroDechetBatch createMacroDechetBatch(MacroDechetBatch bean);
+
+ MacroDechetBatch saveMacroDechetBatch(MacroDechetBatch bean);
+
+ //------------------------------------------------------------------------//
+ //-- Accidentel Batch methods --//
+ //------------------------------------------------------------------------//
+
+ List<AccidentelBatch> getAllAccidentelBatch(String traitId);
+
+ AccidentelBatch getAccidentelBatch(String id);
+
+ AccidentelBatch createAccidentelBatch(AccidentelBatch bean);
+
+ AccidentelBatch saveAccidentelBatch(AccidentelBatch bean);
+
}
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,48 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import java.io.Serializable;
-
-/**
- * Abstract tutti bean.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public abstract class AbstractTuttiBean implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- protected String id;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-}
\ No newline at end of file
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,48 @@
+package fr.ifremer.tutti.persistence.entities;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import java.io.Serializable;
+
+/**
+ * Abstract tutti entity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public abstract class AbstractTuttiEntity implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String id;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,134 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
-import fr.ifremer.tutti.persistence.entities.referential.GearBean;
-import fr.ifremer.tutti.persistence.entities.referential.UserBean;
-import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
-
-import java.util.List;
-
-/**
- * To represent a campaign.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class CampaignBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected SurveyBean survey;
-
- protected CountryBean country;
-
- protected String name;
-
- protected String surveyPart;
-
- protected List<VesselBean> vessel;
-
- protected List<GearBean> gear;
-
- protected List<UserBean> headOfMission;
-
- protected List<UserBean> headOfSortRoom;
-
- protected String comment;
-
- public SurveyBean getSurvey() {
- return survey;
- }
-
- public void setSurvey(SurveyBean survey) {
- this.survey = survey;
- }
-
- public CountryBean getCountry() {
- return country;
- }
-
- public void setCountry(CountryBean country) {
- this.country = country;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getSurveyPart() {
- return surveyPart;
- }
-
- public void setSurveyPart(String surveyPart) {
- this.surveyPart = surveyPart;
- }
-
- public List<VesselBean> getVessel() {
- return vessel;
- }
-
- public void setVessel(List<VesselBean> vessel) {
- this.vessel = vessel;
- }
-
- public List<GearBean> getGear() {
- return gear;
- }
-
- public void setGear(List<GearBean> gear) {
- this.gear = gear;
- }
-
- public List<UserBean> getHeadOfMission() {
- return headOfMission;
- }
-
- public void setHeadOfMission(List<UserBean> headOfMission) {
- this.headOfMission = headOfMission;
- }
-
- public List<UserBean> getHeadOfSortRoom() {
- return headOfSortRoom;
- }
-
- public void setHeadOfSortRoom(List<UserBean> headOfSortRoom) {
- this.headOfSortRoom = headOfSortRoom;
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-
-}
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,38 @@
+package fr.ifremer.tutti.persistence.entities;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * For any bean which can have a comment.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public interface CommentAware {
+
+ String getComment();
+
+ void setComment(String comment);
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,40 @@
+package fr.ifremer.tutti.persistence.entities;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+
+/**
+ * For any bean which relies to a {@link Species}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public interface SpeciesAware {
+
+ Species getSpecies();
+
+ void setSpecies(Species species);
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,47 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-/**
- * Represents a strata.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class StrataBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,68 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
-
-/**
- * To represent a survey.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SurveyBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- protected String comment;
-
- protected ZoneBean zone;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-
- public ZoneBean getZone() {
- return zone;
- }
-
- public void setZone(ZoneBean zone) {
- this.zone = zone;
- }
-}
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,473 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
-import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
-import fr.ifremer.tutti.persistence.entities.referential.UserBean;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * To represent a trait.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class TraitBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected CampaignBean campaign;
-
- protected Integer stationNumber;
-
- protected Integer traitNumber;
-
- protected Date date;
-
- protected StrataBean strate;
-
- protected Float gearShootingStartLatitude;
-
- protected Float gearShootingStartLongitude;
-
- protected Date gearShootingStartTime;
-
- protected Float gearShootingStartDepth;
-
- protected Float gearShootingEndLatitude;
-
- protected Float gearShootingEndLongitude;
-
- protected Date gearShootingEndTime;
-
- protected Float gearShootingEndDepth;
-
- protected BeaufortScaleBean beaufortScale;
-
- protected Integer windDirection;
-
- protected SeaStateBean seaState;
-
- protected Float ouvertureHorizontale;
-
- protected Float ouvertureVerticale;
-
- protected boolean geometrieMesuree;
-
- protected Float longueurFunes;
-
- protected Float longueurBras;
-
- protected boolean systemeFermetureCul;
-
- protected boolean traitRectiligne;
-
- protected Float distanceChalutee;
-
- protected Float duree;
-
- protected boolean traitValid;
-
- protected String localite;
-
- protected String comment;
-
- protected List<UserBean> 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 Float speciesTotalWeight;
-
- protected Float speciesTotalVracWeight;
-
- protected Float speciesSampleVracWeight;
-
- protected Float speciesTotalHorsVracWeight;
-
- public CampaignBean getCampaign() {
- return campaign;
- }
-
- public void setCampaign(CampaignBean campaign) {
- this.campaign = campaign;
- }
-
- public Integer getStationNumber() {
- return stationNumber;
- }
-
- public void setStationNumber(Integer stationNumber) {
- this.stationNumber = stationNumber;
- }
-
- public Integer getTraitNumber() {
- return traitNumber;
- }
-
- public void setTraitNumber(Integer traitNumber) {
- this.traitNumber = traitNumber;
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- this.date = date;
- }
-
- public Float getGearShootingStartLatitude() {
- return gearShootingStartLatitude;
- }
-
- public void setGearShootingStartLatitude(Float gearShootingStartLatitude) {
- this.gearShootingStartLatitude = gearShootingStartLatitude;
- }
-
- public Float getGearShootingStartLongitude() {
- return gearShootingStartLongitude;
- }
-
- public void setGearShootingStartLongitude(Float gearShootingStartLongitude) {
- this.gearShootingStartLongitude = gearShootingStartLongitude;
- }
-
- public Date getGearShootingStartTime() {
- return gearShootingStartTime;
- }
-
- public void setGearShootingStartTime(Date gearShootingStartTime) {
- this.gearShootingStartTime = gearShootingStartTime;
- }
-
- public Float getGearShootingStartDepth() {
- return gearShootingStartDepth;
- }
-
- public void setGearShootingStartDepth(Float gearShootingStartDepth) {
- this.gearShootingStartDepth = gearShootingStartDepth;
- }
-
- public Float getGearShootingEndLatitude() {
- return gearShootingEndLatitude;
- }
-
- public void setGearShootingEndLatitude(Float gearShootingEndLatitude) {
- this.gearShootingEndLatitude = gearShootingEndLatitude;
- }
-
- public Float getGearShootingEndLongitude() {
- return gearShootingEndLongitude;
- }
-
- public void setGearShootingEndLongitude(Float gearShootingEndLongitude) {
- this.gearShootingEndLongitude = gearShootingEndLongitude;
- }
-
- public Date getGearShootingEndTime() {
- return gearShootingEndTime;
- }
-
- public void setGearShootingEndTime(Date gearShootingEndTime) {
- this.gearShootingEndTime = gearShootingEndTime;
- }
-
- public Float getGearShootingEndDepth() {
- return gearShootingEndDepth;
- }
-
- public void setGearShootingEndDepth(Float gearShootingEndDepth) {
- this.gearShootingEndDepth = gearShootingEndDepth;
- }
-
- public Float getOuvertureHorizontale() {
- return ouvertureHorizontale;
- }
-
- public void setOuvertureHorizontale(Float ouvertureHorizontale) {
- this.ouvertureHorizontale = ouvertureHorizontale;
- }
-
- public Float getOuvertureVerticale() {
- return ouvertureVerticale;
- }
-
- public void setOuvertureVerticale(Float ouvertureVerticale) {
- this.ouvertureVerticale = ouvertureVerticale;
- }
-
- public boolean getGeometrieMesuree() {
- return geometrieMesuree;
- }
-
- public void isGeometrieMesuree(boolean geometrieMesuree) {
- this.geometrieMesuree = geometrieMesuree;
- }
-
- public Float getLongueurFunes() {
- return longueurFunes;
- }
-
- public void setLongueurFunes(Float longueurFunes) {
- this.longueurFunes = longueurFunes;
- }
-
- public Float getLongueurBras() {
- return longueurBras;
- }
-
- public void setLongueurBras(Float longueurBras) {
- this.longueurBras = longueurBras;
- }
-
- public boolean getSystemeFermetureCul() {
- return systemeFermetureCul;
- }
-
- public void setSystemeFermetureCul(boolean systemeFermetureCul) {
- this.systemeFermetureCul = systemeFermetureCul;
- }
-
- public boolean isTraitRectiligne() {
- return traitRectiligne;
- }
-
- public void setTraitRectiligne(boolean traitRectiligne) {
- this.traitRectiligne = traitRectiligne;
- }
-
- public Float getDistanceChalutee() {
- return distanceChalutee;
- }
-
- public void setDistanceChalutee(Float distanceChalutee) {
- this.distanceChalutee = distanceChalutee;
- }
-
- public Float getDuree() {
- return duree;
- }
-
- public void setDuree(Float duree) {
- this.duree = duree;
- }
-
- public boolean isTraitValid() {
- return traitValid;
- }
-
- public void setTraitValid(boolean traitValid) {
- this.traitValid = traitValid;
- }
-
- public String getLocalite() {
- return localite;
- }
-
- public void setLocalite(String localite) {
- this.localite = localite;
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-
- public List<UserBean> getSaisisseur() {
- return saisisseur;
- }
-
- public void setSaisisseur(List<UserBean> saisisseur) {
- this.saisisseur = saisisseur;
- }
-
- public StrataBean getStrate() {
- return strate;
- }
-
- public void setStrate(StrataBean strate) {
- this.strate = strate;
- }
-
- public BeaufortScaleBean getBeaufortScale() {
- return beaufortScale;
- }
-
- public void setBeaufortScale(BeaufortScaleBean beaufortScale) {
- this.beaufortScale = beaufortScale;
- }
-
- public Integer getWindDirection() {
- return windDirection;
- }
-
- public void setWindDirection(Integer windDirection) {
- this.windDirection = windDirection;
- }
-
- public SeaStateBean getSeaState() {
- return seaState;
- }
-
- public void setSeaState(SeaStateBean seaState) {
- this.seaState = seaState;
- }
-
- public Float getGearShootingStartSurfaceTemperature() {
- return gearShootingStartSurfaceTemperature;
- }
-
- public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) {
- this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature;
- }
-
- public Float getGearShootingEndSurfaceTemperature() {
- return gearShootingEndSurfaceTemperature;
- }
-
- public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) {
- this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature;
- }
-
- public Float getGearShootingStartBottomTemperature() {
- return gearShootingStartBottomTemperature;
- }
-
- public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) {
- this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature;
- }
-
- public Float getGearShootingEndBottomTemperature() {
- return gearShootingEndBottomTemperature;
- }
-
- public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) {
- this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature;
- }
-
- public Float getAverageBottomTemperature() {
- return averageBottomTemperature;
- }
-
- public void setAverageBottomTemperature(Float averageBottomTemperature) {
- this.averageBottomTemperature = averageBottomTemperature;
- }
-
- public Float getGearShootingStartSurfaceSalinity() {
- return gearShootingStartSurfaceSalinity;
- }
-
- public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) {
- this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity;
- }
-
- public Float getGearShootingEndSurfaceSalinity() {
- return gearShootingEndSurfaceSalinity;
- }
-
- public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) {
- this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity;
- }
-
- public Float getGearShootingStartBottomSalinity() {
- return gearShootingStartBottomSalinity;
- }
-
- public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) {
- this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity;
- }
-
- public Float getGearShootingEndBottomSalinity() {
- return gearShootingEndBottomSalinity;
- }
-
- public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) {
- this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity;
- }
-
- public Float getAverageBottomSalinity() {
- return averageBottomSalinity;
- }
-
- public void setAverageBottomSalinity(Float averageBottomSalinity) {
- this.averageBottomSalinity = averageBottomSalinity;
- }
-
- public Float getSpeciesTotalWeight() {
- return speciesTotalWeight;
- }
-
- public void setSpeciesTotalWeight(Float speciesTotalWeight) {
- this.speciesTotalWeight = speciesTotalWeight;
- }
-
- public Float getSpeciesTotalVracWeight() {
- return speciesTotalVracWeight;
- }
-
- public void setSpeciesTotalVracWeight(Float speciesTotalVracWeight) {
- this.speciesTotalVracWeight = speciesTotalVracWeight;
- }
-
- public Float getSpeciesSampleVracWeight() {
- return speciesSampleVracWeight;
- }
-
- public void setSpeciesSampleVracWeight(Float speciesSampleVracWeight) {
- this.speciesSampleVracWeight = speciesSampleVracWeight;
- }
-
- public Float getSpeciesTotalHorsVracWeight() {
- return speciesTotalHorsVracWeight;
- }
-
- public void setSpeciesTotalHorsVracWeight(Float speciesTotalHorsVracWeight) {
- this.speciesTotalHorsVracWeight = speciesTotalHorsVracWeight;
- }
-}
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,143 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-
-/**
- * Represents a benthos catch while a trait.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class TraitBenthosCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * When catch was observed.
- *
- * @since 0.2
- */
- protected TraitBean trait;
-
- /**
- * Species observed.
- *
- * @since 0.2
- */
- protected SpeciesBean species;
-
- /**
- * Is the species need to be confirmed?.
- *
- * @since 0.2
- */
- protected boolean speciesToConfirm;
-
- /**
- * Is catch is vrac or horsVrac?.
- *
- * @since 0.2
- */
- protected VracHorsVracEnum vracHorsVrac;
-
- /**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- /**
- * Sample weight.
- *
- * @since 0.2
- */
- protected Float sampleWeight;
-
- /**
- * Elevation ratio.
- *
- * @since 0.2
- */
- protected Float elevationRatio;
-
- public TraitBean getTrait() {
- return trait;
- }
-
- public void setTrait(TraitBean trait) {
- this.trait = trait;
- }
-
- public SpeciesBean getSpecies() {
- return species;
- }
-
- public void setSpecies(SpeciesBean species) {
- this.species = species;
- }
-
- public boolean isSpeciesToConfirm() {
- return speciesToConfirm;
- }
-
- public void setSpeciesToConfirm(boolean speciesToConfirm) {
- this.speciesToConfirm = speciesToConfirm;
- }
-
- public VracHorsVracEnum getVracHorsVrac() {
- return vracHorsVrac;
- }
-
- public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) {
- this.vracHorsVrac = vracHorsVrac;
- }
-
- public Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- this.weight = weight;
- }
-
- public Float getSampleWeight() {
- return sampleWeight;
- }
-
- public void setSampleWeight(Float sampleWeight) {
- this.sampleWeight = sampleWeight;
- }
-
- public Float getElevationRatio() {
- return elevationRatio;
- }
-
- public void setElevationRatio(Float elevationRatio) {
- this.elevationRatio = elevationRatio;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,84 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-
-/**
- * Represents a capture accidentel catch while a trait.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class TraitCaptureAccidentelCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware{
-
- private static final long serialVersionUID = 1L;
-
- /**
- * When catch was observed.
- *
- * @since 0.2
- */
- protected TraitBean trait;
-
- /**
- * Species observed.
- *
- * @since 0.2
- */
- protected SpeciesBean species;
-
- /**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- public TraitBean getTrait() {
- return trait;
- }
-
- public void setTrait(TraitBean trait) {
- this.trait = trait;
- }
-
- public SpeciesBean getSpecies() {
- return species;
- }
-
- public void setSpecies(SpeciesBean species) {
- this.species = species;
- }
-
- public Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- this.weight = weight;
- }
-
-}
\ No newline at end of file
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,38 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-/**
- * For any bean which relies to a {@link TraitBean}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public interface TraitCatchBeanAware {
-
- TraitBean getTrait();
-
- void setTrait(TraitBean trait);
-}
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,84 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-
-/**
- * Represents a macro dechet catch while a trait.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class TraitMacroDechetCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware{
-
- private static final long serialVersionUID = 1L;
-
- /**
- * When catch was observed.
- *
- * @since 0.2
- */
- protected TraitBean trait;
-
- /**
- * Species observed.
- *
- * @since 0.2
- */
- protected SpeciesBean species;
-
- /**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- public TraitBean getTrait() {
- return trait;
- }
-
- public void setTrait(TraitBean trait) {
- this.trait = trait;
- }
-
- public SpeciesBean getSpecies() {
- return species;
- }
-
- public void setSpecies(SpeciesBean species) {
- this.species = species;
- }
-
- public Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- this.weight = weight;
- }
-
-}
\ No newline at end of file
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,84 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-
-/**
- * Represents a plancton catch while a trait.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class TraitPlanctonCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware{
-
- private static final long serialVersionUID = 1L;
-
- /**
- * When catch was observed.
- *
- * @since 0.2
- */
- protected TraitBean trait;
-
- /**
- * Species observed.
- *
- * @since 0.2
- */
- protected SpeciesBean species;
-
- /**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- public TraitBean getTrait() {
- return trait;
- }
-
- public void setTrait(TraitBean trait) {
- this.trait = trait;
- }
-
- public SpeciesBean getSpecies() {
- return species;
- }
-
- public void setSpecies(SpeciesBean species) {
- this.species = species;
- }
-
- public Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- this.weight = weight;
- }
-
-}
\ No newline at end of file
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,220 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.referential.SexBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
-
-/**
- * Represents a catch of species while a trait.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class TraitSpeciesCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * When catch was observed.
- *
- * @since 0.2
- */
- protected TraitBean trait;
-
- /**
- * Species observed.
- *
- * @since 0.2
- */
- protected SpeciesBean species;
-
- /**
- * Is the species need to be confirmed?.
- *
- * @since 0.2
- */
- protected boolean speciesToConfirm;
-
- /**
- * Is catch is vrac or horsVrac?.
- *
- * @since 0.2
- */
- protected VracHorsVracEnum vracHorsVrac;
-
- /**
- * Weight category (can be null).
- *
- * @since 0.2
- */
- protected WeightCategoryBean weightCategory;
-
- /**
- * Sex (can be null).
- *
- * @since 0.2
- */
- protected SexBean sex;
-
- /**
- * Maturity (can be null).
- *
- * @since 0.2
- */
- protected Float maturity;
-
- /**
- * Age (can be null).
- *
- * @since 0.2
- */
- protected Float age;
-
- /**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- /**
- * Sample weight.
- *
- * @since 0.2
- */
- protected Float sampleWeight;
-
- /**
- * Elevation ratio.
- *
- * @since 0.2
- */
- protected Float elevationRatio;
-
- /**
- * Comment on this catches.
- *
- * @since 0.2
- */
- protected String comment;
-
- public TraitBean getTrait() {
- return trait;
- }
-
- public void setTrait(TraitBean trait) {
- this.trait = trait;
- }
-
- public SpeciesBean getSpecies() {
- return species;
- }
-
- public void setSpecies(SpeciesBean species) {
- this.species = species;
- }
-
- public Boolean getSpeciesToConfirm() {
- return speciesToConfirm;
- }
-
- public void setSpeciesToConfirm(Boolean speciesToConfirm) {
- this.speciesToConfirm = speciesToConfirm;
- }
-
- public VracHorsVracEnum getVracHorsVrac() {
- return vracHorsVrac;
- }
-
- public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) {
- this.vracHorsVrac = vracHorsVrac;
- }
-
- public WeightCategoryBean getWeightCategory() {
- return weightCategory;
- }
-
- public void setWeightCategory(WeightCategoryBean weightCategory) {
- this.weightCategory = weightCategory;
- }
-
- public SexBean getSex() {
- return sex;
- }
-
- public void setSex(SexBean sex) {
- this.sex = sex;
- }
-
- public Float getMaturity() {
- return maturity;
- }
-
- public void setMaturity(Float maturity) {
- this.maturity = maturity;
- }
-
- public Float getAge() {
- return age;
- }
-
- public void setAge(Float age) {
- this.age = age;
- }
-
- public Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- this.weight = weight;
- }
-
- public Float getSampleWeight() {
- return sampleWeight;
- }
-
- public void setSampleWeight(Float sampleWeight) {
- this.sampleWeight = sampleWeight;
- }
-
- public Float getElevationRatio() {
- return elevationRatio;
- }
-
- public void setElevationRatio(Float elevationRatio) {
- this.elevationRatio = elevationRatio;
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-}
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,89 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-
-import java.util.Collection;
-
-/**
- * Usefull method around tutti beans.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class TuttiBeans {
-
- public static <B extends AbstractTuttiBean> boolean isNew(B bean) {
- return bean.getId() == null;
- }
-
- public static <B extends AbstractTuttiBean> Predicate<B> newIdPredicate(String id) {
- return new IdPredicate<B>(id);
- }
-
- public static <B extends AbstractTuttiBean & TraitCatchBeanAware> Predicate<B> newTraitIdPredicate(String id) {
- return new TraitIdPredicate<B>(id);
- }
-
- public static <B extends AbstractTuttiBean> B findById(Collection<B> beans,
- String id) {
- B result = Iterables.tryFind(beans, newIdPredicate(id)).orNull();
- return result;
- }
-
- protected TuttiBeans() {
- // helper class does not instanciate
- }
-
- protected static class IdPredicate<B extends AbstractTuttiBean> implements Predicate<B> {
-
- private final String id;
-
- public IdPredicate(String id) {
- this.id = id;
- }
-
- @Override
- public boolean apply(B input) {
- return id.equals(input.getId());
- }
- }
-
- protected static class TraitIdPredicate<B extends AbstractTuttiBean & TraitCatchBeanAware> implements Predicate<B> {
-
- private final String id;
-
- public TraitIdPredicate(String id) {
- this.id = id;
- }
-
- @Override
- public boolean apply(B input) {
- return id.equals(input.getTrait().getId());
- }
- }
-}
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,128 @@
+package fr.ifremer.tutti.persistence.entities;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Throwables;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import fr.ifremer.tutti.persistence.entities.data.TraitAware;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Usefull method around tutti entities.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class TuttiEntities {
+
+ protected TuttiEntities() {
+ // helper class does not instanciate
+ }
+
+ public static <B extends AbstractTuttiEntity> List<String> toIds(List<B> list) {
+ List<String> result = list == null ?
+ Collections.<String>emptyList() :
+ Lists.transform(list, new Function<B, String>() {
+ @Override
+ public String apply(B input) {
+ return input.getId();
+ }
+ });
+ return result;
+ }
+
+ public static <B extends AbstractTuttiEntity> Map<String, B> splitById(Iterable<B> list) {
+ return Maps.uniqueIndex(list, GET_ID);
+ }
+
+ public static final Function<AbstractTuttiEntity, String> GET_ID = new Function<AbstractTuttiEntity, String>() {
+ @Override
+ public String apply(AbstractTuttiEntity input) {
+ return input.getId();
+ }
+ };
+
+ public static <B extends AbstractTuttiEntity> boolean isNew(B bean) {
+ return bean.getId() == null;
+ }
+
+ public static <B extends AbstractTuttiEntity> Predicate<B> newIdPredicate(String id) {
+ return new IdPredicate<B>(id);
+ }
+
+ public static <B extends AbstractTuttiEntity & TraitAware> Predicate<B> newTraitIdPredicate(String id) {
+ return new TraitIdPredicate<B>(id);
+ }
+
+ public static <B extends AbstractTuttiEntity> B findById(Iterable<B> beans,
+ String id) {
+ B result = Iterables.tryFind(beans, newIdPredicate(id)).orNull();
+ return result;
+ }
+
+ protected static class IdPredicate<B extends AbstractTuttiEntity> implements Predicate<B> {
+
+ private final String id;
+
+ public IdPredicate(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public boolean apply(B input) {
+ return id.equals(input.getId());
+ }
+ }
+
+ protected static class TraitIdPredicate<B extends AbstractTuttiEntity & TraitAware> implements Predicate<B> {
+
+ private final String id;
+
+ public TraitIdPredicate(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public boolean apply(B input) {
+ return id.equals(input.getTrait().getId());
+ }
+ }
+
+ public static <B extends AbstractTuttiEntity> B newEntity(B entity) {
+ try {
+ Class<B> aClass = (Class<B>) entity.getClass();
+ return aClass.newInstance();
+ } catch (Exception e) {
+ throw Throwables.propagate(e);
+ }
+ }
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,34 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public enum VracHorsVracEnum {
- VRAC,
- HORS_VRAC
-}
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AbstractTraitBatch.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AbstractTraitBatch.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AbstractTraitBatch.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,108 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AbstractTraitBatch extends AbstractTuttiEntity implements TraitAware {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * When batch was observed.
+ *
+ * @since 0.2
+ */
+ protected Trait trait;
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected Species species;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Comment.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ @Override
+ public final Trait getTrait() {
+ return trait;
+ }
+
+ @Override
+ public final void setTrait(Trait trait) {
+ this.trait = trait;
+ }
+
+ @Override
+ public final Species getSpecies() {
+ return species;
+ }
+
+ @Override
+ public final void setSpecies(Species species) {
+ this.species = species;
+ }
+
+ @Override
+ public final String getComment() {
+ return comment;
+ }
+
+ @Override
+ public final void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ @Override
+ public final Float getWeight() {
+ return weight;
+ }
+
+ @Override
+ public final void setWeight(Float weight) {
+ this.weight = weight;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AbstractTraitBatch.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AccidentelBatch.java (from rev 25, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AccidentelBatch.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AccidentelBatch.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,37 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * Represents a accidentel batch.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentelBatch extends AbstractTraitBatch {
+
+ private static final long serialVersionUID = 1L;
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AccidentelBatch.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BenthosBatch.java (from rev 25, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BenthosBatch.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BenthosBatch.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,96 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * Represents a benthos batch.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class BenthosBatch extends AbstractTraitBatch {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 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;
+
+ /**
+ * Sample weight.
+ *
+ * @since 0.2
+ */
+ protected Float sampleWeight;
+
+ /**
+ * Elevation ratio.
+ *
+ * @since 0.2
+ */
+ protected Float elevationRatio;
+
+ public boolean isSpeciesToConfirm() {
+ return speciesToConfirm;
+ }
+
+ public void setSpeciesToConfirm(boolean speciesToConfirm) {
+ this.speciesToConfirm = speciesToConfirm;
+ }
+
+ public VracHorsVracEnum getVracHorsVrac() {
+ return vracHorsVrac;
+ }
+
+ public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) {
+ this.vracHorsVrac = vracHorsVrac;
+ }
+
+ public Float getSampleWeight() {
+ return sampleWeight;
+ }
+
+ public void setSampleWeight(Float sampleWeight) {
+ this.sampleWeight = sampleWeight;
+ }
+
+ public Float getElevationRatio() {
+ return elevationRatio;
+ }
+
+ public void setElevationRatio(Float elevationRatio) {
+ this.elevationRatio = elevationRatio;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BenthosBatch.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Campaign.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Campaign.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Campaign.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,138 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+import fr.ifremer.tutti.persistence.entities.CommentAware;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+
+import java.util.List;
+
+/**
+ * To represent a campaign.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class Campaign extends AbstractTuttiEntity implements CommentAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Survey survey;
+
+ protected Country country;
+
+ protected String name;
+
+ protected String surveyPart;
+
+ protected List<Vessel> vessel;
+
+ protected List<Gear> gear;
+
+ protected List<TuttiUser> headOfMission;
+
+ protected List<TuttiUser> headOfSortRoom;
+
+ protected String comment;
+
+ public Survey getSurvey() {
+ return survey;
+ }
+
+ public void setSurvey(Survey survey) {
+ this.survey = survey;
+ }
+
+ public Country getCountry() {
+ return country;
+ }
+
+ public void setCountry(Country country) {
+ this.country = country;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getSurveyPart() {
+ return surveyPart;
+ }
+
+ public void setSurveyPart(String surveyPart) {
+ this.surveyPart = surveyPart;
+ }
+
+ public List<Vessel> getVessel() {
+ return vessel;
+ }
+
+ public void setVessel(List<Vessel> vessel) {
+ this.vessel = vessel;
+ }
+
+ public List<Gear> getGear() {
+ return gear;
+ }
+
+ public void setGear(List<Gear> gear) {
+ this.gear = gear;
+ }
+
+ public List<TuttiUser> getHeadOfMission() {
+ return headOfMission;
+ }
+
+ public void setHeadOfMission(List<TuttiUser> headOfMission) {
+ this.headOfMission = headOfMission;
+ }
+
+ public List<TuttiUser> getHeadOfSortRoom() {
+ return headOfSortRoom;
+ }
+
+ public void setHeadOfSortRoom(List<TuttiUser> headOfSortRoom) {
+ this.headOfSortRoom = headOfSortRoom;
+ }
+
+ @Override
+ public String getComment() {
+ return comment;
+ }
+
+ @Override
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Campaign.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/MacroDechetBatch.java (from rev 25, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/MacroDechetBatch.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/MacroDechetBatch.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,37 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * Represents a macro dechet batch.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroDechetBatch extends AbstractTraitBatch {
+
+ private static final long serialVersionUID = 1L;
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/MacroDechetBatch.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/PlanctonBatch.java (from rev 25, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/PlanctonBatch.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/PlanctonBatch.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,36 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * Represents a plancton batch.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanctonBatch extends AbstractTraitBatch {
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/PlanctonBatch.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatch.java (from rev 27, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatch.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatch.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,160 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.referential.Sex;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
+
+/**
+ * Represents a species batch.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesBatch extends AbstractTraitBatch {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 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;
+
+ /**
+ * Sample weight.
+ *
+ * @since 0.2
+ */
+ protected Float sampleWeight;
+
+ /**
+ * Elevation ratio.
+ *
+ * @since 0.2
+ */
+ protected Float elevationRatio;
+
+ public Boolean getSpeciesToConfirm() {
+ return speciesToConfirm;
+ }
+
+ public void setSpeciesToConfirm(Boolean speciesToConfirm) {
+ this.speciesToConfirm = speciesToConfirm;
+ }
+
+ public VracHorsVracEnum getVracHorsVrac() {
+ return vracHorsVrac;
+ }
+
+ public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) {
+ this.vracHorsVrac = vracHorsVrac;
+ }
+
+ public WeightCategory getWeightCategory() {
+ return weightCategory;
+ }
+
+ public void setWeightCategory(WeightCategory weightCategory) {
+ this.weightCategory = weightCategory;
+ }
+
+ public Sex getSex() {
+ return sex;
+ }
+
+ public void setSex(Sex sex) {
+ this.sex = sex;
+ }
+
+ public Float getMaturity() {
+ return maturity;
+ }
+
+ public void setMaturity(Float maturity) {
+ this.maturity = maturity;
+ }
+
+ public Float getAge() {
+ return age;
+ }
+
+ public void setAge(Float age) {
+ this.age = age;
+ }
+
+ public Float getSampleWeight() {
+ return sampleWeight;
+ }
+
+ public void setSampleWeight(Float sampleWeight) {
+ this.sampleWeight = sampleWeight;
+ }
+
+ public Float getElevationRatio() {
+ return elevationRatio;
+ }
+
+ public void setElevationRatio(Float elevationRatio) {
+ this.elevationRatio = elevationRatio;
+ }
+
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatch.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchFrequency.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchFrequency.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchFrequency.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,98 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+
+/**
+ * Represents sampling frequency inside a {@link SpeciesBatch}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesBatchFrequency extends AbstractTuttiEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Batch.
+ *
+ * @since 0.2
+ */
+ protected SpeciesBatch batch;
+
+ /**
+ * Length step.
+ *
+ * @since 0.2
+ */
+ protected Float lengthStep;
+
+ /**
+ * Count of fishes for this lengthStep.
+ *
+ * @since 0.2
+ */
+ protected Integer number;
+
+ /**
+ * Weight of fishes.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ public SpeciesBatch getBatch() {
+ return batch;
+ }
+
+ public void setBatch(SpeciesBatch batch) {
+ this.batch = batch;
+ }
+
+ public Float getLengthStep() {
+ return lengthStep;
+ }
+
+ public void setLengthStep(Float lengthStep) {
+ this.lengthStep = lengthStep;
+ }
+
+ public Integer getNumber() {
+ return number;
+ }
+
+ public void setNumber(Integer number) {
+ this.number = number;
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ this.weight = weight;
+ }
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchFrequency.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Strata.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Strata.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Strata.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+
+/**
+ * Represents a strata.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class Strata extends AbstractTuttiEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Strata.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Survey.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Survey.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Survey.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,72 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+import fr.ifremer.tutti.persistence.entities.CommentAware;
+import fr.ifremer.tutti.persistence.entities.referential.Zone;
+
+/**
+ * To represent a survey.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class Survey extends AbstractTuttiEntity implements CommentAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ protected String comment;
+
+ protected Zone zone;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getComment() {
+ return comment;
+ }
+
+ @Override
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ public Zone getZone() {
+ return zone;
+ }
+
+ public void setZone(Zone zone) {
+ this.zone = zone;
+ }
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Survey.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Trait.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Trait.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Trait.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,477 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+import fr.ifremer.tutti.persistence.entities.CommentAware;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.SeaState;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * To represent a trait.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class Trait extends AbstractTuttiEntity implements CommentAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Campaign campaign;
+
+ protected Integer stationNumber;
+
+ protected Integer traitNumber;
+
+ protected Date date;
+
+ protected Strata strate;
+
+ protected Float gearShootingStartLatitude;
+
+ protected Float gearShootingStartLongitude;
+
+ protected Date gearShootingStartTime;
+
+ protected Float gearShootingStartDepth;
+
+ protected Float gearShootingEndLatitude;
+
+ protected Float gearShootingEndLongitude;
+
+ protected Date 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 traitRectiligne;
+
+ protected Float distanceChalutee;
+
+ protected Float duree;
+
+ protected boolean traitValid;
+
+ protected String localite;
+
+ protected String comment;
+
+ protected List<TuttiUser> 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 Float speciesTotalWeight;
+
+ protected Float speciesTotalVracWeight;
+
+ protected Float speciesSampleVracWeight;
+
+ protected Float speciesTotalHorsVracWeight;
+
+ public Campaign getCampaign() {
+ return campaign;
+ }
+
+ public void setCampaign(Campaign campaign) {
+ this.campaign = campaign;
+ }
+
+ public Integer getStationNumber() {
+ return stationNumber;
+ }
+
+ public void setStationNumber(Integer stationNumber) {
+ this.stationNumber = stationNumber;
+ }
+
+ public Integer getTraitNumber() {
+ return traitNumber;
+ }
+
+ public void setTraitNumber(Integer traitNumber) {
+ this.traitNumber = traitNumber;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public Float getGearShootingStartLatitude() {
+ return gearShootingStartLatitude;
+ }
+
+ public void setGearShootingStartLatitude(Float gearShootingStartLatitude) {
+ this.gearShootingStartLatitude = gearShootingStartLatitude;
+ }
+
+ public Float getGearShootingStartLongitude() {
+ return gearShootingStartLongitude;
+ }
+
+ public void setGearShootingStartLongitude(Float gearShootingStartLongitude) {
+ this.gearShootingStartLongitude = gearShootingStartLongitude;
+ }
+
+ public Date getGearShootingStartTime() {
+ return gearShootingStartTime;
+ }
+
+ public void setGearShootingStartTime(Date gearShootingStartTime) {
+ this.gearShootingStartTime = gearShootingStartTime;
+ }
+
+ public Float getGearShootingStartDepth() {
+ return gearShootingStartDepth;
+ }
+
+ public void setGearShootingStartDepth(Float gearShootingStartDepth) {
+ this.gearShootingStartDepth = gearShootingStartDepth;
+ }
+
+ public Float getGearShootingEndLatitude() {
+ return gearShootingEndLatitude;
+ }
+
+ public void setGearShootingEndLatitude(Float gearShootingEndLatitude) {
+ this.gearShootingEndLatitude = gearShootingEndLatitude;
+ }
+
+ public Float getGearShootingEndLongitude() {
+ return gearShootingEndLongitude;
+ }
+
+ public void setGearShootingEndLongitude(Float gearShootingEndLongitude) {
+ this.gearShootingEndLongitude = gearShootingEndLongitude;
+ }
+
+ public Date getGearShootingEndTime() {
+ return gearShootingEndTime;
+ }
+
+ public void setGearShootingEndTime(Date gearShootingEndTime) {
+ this.gearShootingEndTime = gearShootingEndTime;
+ }
+
+ public Float getGearShootingEndDepth() {
+ return gearShootingEndDepth;
+ }
+
+ public void setGearShootingEndDepth(Float gearShootingEndDepth) {
+ this.gearShootingEndDepth = gearShootingEndDepth;
+ }
+
+ public Float getOuvertureHorizontale() {
+ return ouvertureHorizontale;
+ }
+
+ public void setOuvertureHorizontale(Float ouvertureHorizontale) {
+ this.ouvertureHorizontale = ouvertureHorizontale;
+ }
+
+ public Float getOuvertureVerticale() {
+ return ouvertureVerticale;
+ }
+
+ public void setOuvertureVerticale(Float ouvertureVerticale) {
+ this.ouvertureVerticale = ouvertureVerticale;
+ }
+
+ public boolean getGeometrieMesuree() {
+ return geometrieMesuree;
+ }
+
+ public void isGeometrieMesuree(boolean geometrieMesuree) {
+ this.geometrieMesuree = geometrieMesuree;
+ }
+
+ public Float getLongueurFunes() {
+ return longueurFunes;
+ }
+
+ public void setLongueurFunes(Float longueurFunes) {
+ this.longueurFunes = longueurFunes;
+ }
+
+ public Float getLongueurBras() {
+ return longueurBras;
+ }
+
+ public void setLongueurBras(Float longueurBras) {
+ this.longueurBras = longueurBras;
+ }
+
+ public boolean getSystemeFermetureCul() {
+ return systemeFermetureCul;
+ }
+
+ public void setSystemeFermetureCul(boolean systemeFermetureCul) {
+ this.systemeFermetureCul = systemeFermetureCul;
+ }
+
+ public boolean isTraitRectiligne() {
+ return traitRectiligne;
+ }
+
+ public void setTraitRectiligne(boolean traitRectiligne) {
+ this.traitRectiligne = traitRectiligne;
+ }
+
+ public Float getDistanceChalutee() {
+ return distanceChalutee;
+ }
+
+ public void setDistanceChalutee(Float distanceChalutee) {
+ this.distanceChalutee = distanceChalutee;
+ }
+
+ public Float getDuree() {
+ return duree;
+ }
+
+ public void setDuree(Float duree) {
+ this.duree = duree;
+ }
+
+ public boolean isTraitValid() {
+ return traitValid;
+ }
+
+ public void setTraitValid(boolean traitValid) {
+ this.traitValid = traitValid;
+ }
+
+ public String getLocalite() {
+ return localite;
+ }
+
+ public void setLocalite(String localite) {
+ this.localite = localite;
+ }
+
+ @Override
+ public String getComment() {
+ return comment;
+ }
+
+ @Override
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ public List<TuttiUser> getSaisisseur() {
+ return saisisseur;
+ }
+
+ public void setSaisisseur(List<TuttiUser> saisisseur) {
+ this.saisisseur = saisisseur;
+ }
+
+ public Strata getStrate() {
+ return strate;
+ }
+
+ public void setStrate(Strata strate) {
+ this.strate = strate;
+ }
+
+ public BeaufortScale getBeaufortScale() {
+ return beaufortScale;
+ }
+
+ public void setBeaufortScale(BeaufortScale beaufortScale) {
+ this.beaufortScale = beaufortScale;
+ }
+
+ public Integer getWindDirection() {
+ return windDirection;
+ }
+
+ public void setWindDirection(Integer windDirection) {
+ this.windDirection = windDirection;
+ }
+
+ public SeaState getSeaState() {
+ return seaState;
+ }
+
+ public void setSeaState(SeaState seaState) {
+ this.seaState = seaState;
+ }
+
+ public Float getGearShootingStartSurfaceTemperature() {
+ return gearShootingStartSurfaceTemperature;
+ }
+
+ public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) {
+ this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature;
+ }
+
+ public Float getGearShootingEndSurfaceTemperature() {
+ return gearShootingEndSurfaceTemperature;
+ }
+
+ public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) {
+ this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature;
+ }
+
+ public Float getGearShootingStartBottomTemperature() {
+ return gearShootingStartBottomTemperature;
+ }
+
+ public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) {
+ this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature;
+ }
+
+ public Float getGearShootingEndBottomTemperature() {
+ return gearShootingEndBottomTemperature;
+ }
+
+ public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) {
+ this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature;
+ }
+
+ public Float getAverageBottomTemperature() {
+ return averageBottomTemperature;
+ }
+
+ public void setAverageBottomTemperature(Float averageBottomTemperature) {
+ this.averageBottomTemperature = averageBottomTemperature;
+ }
+
+ public Float getGearShootingStartSurfaceSalinity() {
+ return gearShootingStartSurfaceSalinity;
+ }
+
+ public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) {
+ this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity;
+ }
+
+ public Float getGearShootingEndSurfaceSalinity() {
+ return gearShootingEndSurfaceSalinity;
+ }
+
+ public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) {
+ this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity;
+ }
+
+ public Float getGearShootingStartBottomSalinity() {
+ return gearShootingStartBottomSalinity;
+ }
+
+ public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) {
+ this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity;
+ }
+
+ public Float getGearShootingEndBottomSalinity() {
+ return gearShootingEndBottomSalinity;
+ }
+
+ public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) {
+ this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity;
+ }
+
+ public Float getAverageBottomSalinity() {
+ return averageBottomSalinity;
+ }
+
+ public void setAverageBottomSalinity(Float averageBottomSalinity) {
+ this.averageBottomSalinity = averageBottomSalinity;
+ }
+
+ public Float getSpeciesTotalWeight() {
+ return speciesTotalWeight;
+ }
+
+ public void setSpeciesTotalWeight(Float speciesTotalWeight) {
+ this.speciesTotalWeight = speciesTotalWeight;
+ }
+
+ public Float getSpeciesTotalVracWeight() {
+ return speciesTotalVracWeight;
+ }
+
+ public void setSpeciesTotalVracWeight(Float speciesTotalVracWeight) {
+ this.speciesTotalVracWeight = speciesTotalVracWeight;
+ }
+
+ public Float getSpeciesSampleVracWeight() {
+ return speciesSampleVracWeight;
+ }
+
+ public void setSpeciesSampleVracWeight(Float speciesSampleVracWeight) {
+ this.speciesSampleVracWeight = speciesSampleVracWeight;
+ }
+
+ public Float getSpeciesTotalHorsVracWeight() {
+ return speciesTotalHorsVracWeight;
+ }
+
+ public void setSpeciesTotalHorsVracWeight(Float speciesTotalHorsVracWeight) {
+ this.speciesTotalHorsVracWeight = speciesTotalHorsVracWeight;
+ }
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Trait.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/TraitAware.java (from rev 25, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/TraitAware.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/TraitAware.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,45 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.CommentAware;
+import fr.ifremer.tutti.persistence.entities.SpeciesAware;
+
+/**
+ * For any bean which relies to a {@link Trait}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public interface TraitAware extends SpeciesAware, CommentAware {
+
+ Trait getTrait();
+
+ void setTrait(Trait trait);
+
+ Float getWeight();
+
+ void setWeight(Float weigth);
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/TraitAware.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/VracHorsVracEnum.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/VracHorsVracEnum.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/VracHorsVracEnum.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,34 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public enum VracHorsVracEnum {
+ VRAC,
+ HORS_VRAC
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/VracHorsVracEnum.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScale.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScale.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScale.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+
+/**
+ * Represents a beaufort scale.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BeaufortScale extends AbstractTuttiEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScale.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,49 +0,0 @@
-package fr.ifremer.tutti.persistence.entities.referential;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
-
-/**
- * Represents a beaufort scale.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BeaufortScaleBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Country.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Country.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Country.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+
+/**
+ * Represents a country.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class Country extends AbstractTuttiEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Country.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,49 +0,0 @@
-package fr.ifremer.tutti.persistence.entities.referential;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
-
-/**
- * Represents a country.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class CountryBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Gear.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Gear.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Gear.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+
+/**
+ * Represents a gear.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class Gear extends AbstractTuttiEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Gear.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,49 +0,0 @@
-package fr.ifremer.tutti.persistence.entities.referential;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
-
-/**
- * Represents a gear.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class GearBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaState.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaState.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaState.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+
+/**
+ * Represents the sea state.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SeaState extends AbstractTuttiEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaState.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,49 +0,0 @@
-package fr.ifremer.tutti.persistence.entities.referential;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
-
-/**
- * Represents the sea state.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SeaStateBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Sex.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Sex.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Sex.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,48 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+
+/**
+ * Represents a sex.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class Sex extends AbstractTuttiEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Sex.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,48 +0,0 @@
-package fr.ifremer.tutti.persistence.entities.referential;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
-
-/**
- * Represents a sex.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SexBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-}
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Species.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Species.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Species.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,58 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+
+/**
+ * Represents a fishes species.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class Species extends AbstractTuttiEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String codeMemo;
+
+ protected String genusSpecies;
+
+ public String getCodeMemo() {
+ return codeMemo;
+ }
+
+ public void setCodeMemo(String codeMemo) {
+ this.codeMemo = codeMemo;
+ }
+
+ public String getGenusSpecies() {
+ return genusSpecies;
+ }
+
+ public void setGenusSpecies(String genusSpecies) {
+ this.genusSpecies = genusSpecies;
+ }
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Species.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,58 +0,0 @@
-package fr.ifremer.tutti.persistence.entities.referential;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
-
-/**
- * Represents a fishes species.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String codeMemo;
-
- protected String genusSpecies;
-
- public String getCodeMemo() {
- return codeMemo;
- }
-
- public void setCodeMemo(String codeMemo) {
- this.codeMemo = codeMemo;
- }
-
- public String getGenusSpecies() {
- return genusSpecies;
- }
-
- public void setGenusSpecies(String genusSpecies) {
- this.genusSpecies = genusSpecies;
- }
-}
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TuttiUser.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TuttiUser.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TuttiUser.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+
+/**
+ * Represents a user.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class TuttiUser extends AbstractTuttiEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TuttiUser.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,49 +0,0 @@
-package fr.ifremer.tutti.persistence.entities.referential;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
-
-/**
- * Represents a user.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class UserBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Vessel.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Vessel.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Vessel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+
+/**
+ * Represents a vessel.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class Vessel extends AbstractTuttiEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Vessel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,49 +0,0 @@
-package fr.ifremer.tutti.persistence.entities.referential;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
-
-/**
- * Represents a vessel.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class VesselBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategory.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategory.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategory.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+
+/**
+ * Represents a weight category.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class WeightCategory extends AbstractTuttiEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategory.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,49 +0,0 @@
-package fr.ifremer.tutti.persistence.entities.referential;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
-
-/**
- * Represents a weight category.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class WeightCategoryBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Zone.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Zone.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Zone.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+
+/**
+ * Represents a survey zone.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class Zone extends AbstractTuttiEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Zone.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,49 +0,0 @@
-package fr.ifremer.tutti.persistence.entities.referential;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
-
-/**
- * Represents a survey zone.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class ZoneBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,18 +25,18 @@
*/
import com.google.common.collect.ArrayListMultimap;
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
-import fr.ifremer.tutti.persistence.entities.StrataBean;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
-import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
-import fr.ifremer.tutti.persistence.entities.referential.GearBean;
-import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
-import fr.ifremer.tutti.persistence.entities.referential.SexBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.persistence.entities.referential.UserBean;
-import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
-import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+import fr.ifremer.tutti.persistence.entities.data.Strata;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.SeaState;
+import fr.ifremer.tutti.persistence.entities.referential.Sex;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
+import fr.ifremer.tutti.persistence.entities.referential.Zone;
import java.util.List;
import java.util.UUID;
@@ -49,7 +49,7 @@
*/
public class TuttiPersistenceDevFixtures {
- protected final ArrayListMultimap<Class<? extends AbstractTuttiBean>, AbstractTuttiBean> cache;
+ protected final ArrayListMultimap<Class<? extends AbstractTuttiEntity>, AbstractTuttiEntity> cache;
public TuttiPersistenceDevFixtures() {
@@ -57,240 +57,240 @@
cache = ArrayListMultimap.create();
- ZoneBean b;
- b = new ZoneBean();
+ Zone b;
+ b = new Zone();
b.setId(UUID.randomUUID().toString());
b.setName("zone1");
- cache.put(ZoneBean.class, b);
+ cache.put(Zone.class, b);
- b = new ZoneBean();
+ b = new Zone();
b.setId(UUID.randomUUID().toString());
b.setName("zone2");
- cache.put(ZoneBean.class, b);
+ cache.put(Zone.class, b);
- CountryBean c;
- c = new CountryBean();
+ Country c;
+ c = new Country();
c.setId(UUID.randomUUID().toString());
c.setName("France");
- cache.put(CountryBean.class, c);
+ cache.put(Country.class, c);
- c = new CountryBean();
+ c = new Country();
c.setId(UUID.randomUUID().toString());
c.setName("Espagne");
- cache.put(CountryBean.class, c);
+ cache.put(Country.class, c);
- VesselBean v;
+ Vessel v;
- v = new VesselBean();
+ v = new Vessel();
v.setId(UUID.randomUUID().toString());
v.setName("THALASSA");
- cache.put(VesselBean.class, v);
+ cache.put(Vessel.class, v);
- v = new VesselBean();
+ v = new Vessel();
v.setId(UUID.randomUUID().toString());
v.setName("THALASSA-II");
- cache.put(VesselBean.class, v);
+ cache.put(Vessel.class, v);
- GearBean g;
+ Gear g;
- g = new GearBean();
+ g = new Gear();
g.setId(UUID.randomUUID().toString());
g.setName("Gear-1");
- cache.put(GearBean.class, g);
+ cache.put(Gear.class, g);
- g = new GearBean();
+ g = new Gear();
g.setId(UUID.randomUUID().toString());
g.setName("Gear-2");
- cache.put(GearBean.class, g);
+ cache.put(Gear.class, g);
- UserBean u;
+ TuttiUser u;
- u = new UserBean();
+ u = new TuttiUser();
u.setId(UUID.randomUUID().toString());
u.setName("Vincent Badts");
- cache.put(UserBean.class, u);
+ cache.put(TuttiUser.class, u);
- u = new UserBean();
+ u = new TuttiUser();
u.setId(UUID.randomUUID().toString());
u.setName("Jean claude Mahet");
- cache.put(UserBean.class, u);
+ cache.put(TuttiUser.class, u);
- u = new UserBean();
+ u = new TuttiUser();
u.setId(UUID.randomUUID().toString());
u.setName("Luisa Metral");
- cache.put(UserBean.class, u);
+ cache.put(TuttiUser.class, u);
- u = new UserBean();
+ u = new TuttiUser();
u.setId(UUID.randomUUID().toString());
u.setName("Jean Hervé Bourdeix");
- cache.put(UserBean.class, u);
+ cache.put(TuttiUser.class, u);
- u = new UserBean();
+ u = new TuttiUser();
u.setId(UUID.randomUUID().toString());
u.setName("Ysabelle Cheret");
- cache.put(UserBean.class, u);
+ cache.put(TuttiUser.class, u);
- u = new UserBean();
+ u = new TuttiUser();
u.setId(UUID.randomUUID().toString());
u.setName("Blandine Brisset");
- cache.put(UserBean.class, u);
+ cache.put(TuttiUser.class, u);
- BeaufortScaleBean bs;
+ BeaufortScale bs;
- bs = new BeaufortScaleBean();
+ bs = new BeaufortScale();
bs.setId(UUID.randomUUID().toString());
bs.setName("Calme");
- cache.put(BeaufortScaleBean.class, bs);
+ cache.put(BeaufortScale.class, bs);
- bs = new BeaufortScaleBean();
+ bs = new BeaufortScale();
bs.setId(UUID.randomUUID().toString());
bs.setName("Très légère brise");
- cache.put(BeaufortScaleBean.class, bs);
+ cache.put(BeaufortScale.class, bs);
- bs = new BeaufortScaleBean();
+ bs = new BeaufortScale();
bs.setId(UUID.randomUUID().toString());
bs.setName("Petite brise");
- cache.put(BeaufortScaleBean.class, bs);
+ cache.put(BeaufortScale.class, bs);
- bs = new BeaufortScaleBean();
+ bs = new BeaufortScale();
bs.setId(UUID.randomUUID().toString());
bs.setName("Jolie brise");
- cache.put(BeaufortScaleBean.class, bs);
+ cache.put(BeaufortScale.class, bs);
- bs = new BeaufortScaleBean();
+ bs = new BeaufortScale();
bs.setId(UUID.randomUUID().toString());
bs.setName("Vent frais");
- cache.put(BeaufortScaleBean.class, bs);
+ cache.put(BeaufortScale.class, bs);
- bs = new BeaufortScaleBean();
+ bs = new BeaufortScale();
bs.setId(UUID.randomUUID().toString());
bs.setName("Grand frais");
- cache.put(BeaufortScaleBean.class, bs);
+ cache.put(BeaufortScale.class, bs);
- bs = new BeaufortScaleBean();
+ bs = new BeaufortScale();
bs.setId(UUID.randomUUID().toString());
bs.setName("Coup de vent");
- cache.put(BeaufortScaleBean.class, bs);
+ cache.put(BeaufortScale.class, bs);
- bs = new BeaufortScaleBean();
+ bs = new BeaufortScale();
bs.setId(UUID.randomUUID().toString());
bs.setName("Fort coup de vent");
- cache.put(BeaufortScaleBean.class, bs);
+ cache.put(BeaufortScale.class, bs);
- SeaStateBean st;
+ SeaState st;
- st = new SeaStateBean();
+ st = new SeaState();
st.setId(UUID.randomUUID().toString());
st.setName("Mer calme");
- cache.put(SeaStateBean.class, st);
+ cache.put(SeaState.class, st);
- st = new SeaStateBean();
+ st = new SeaState();
st.setId(UUID.randomUUID().toString());
st.setName("Mer agitée");
- cache.put(SeaStateBean.class, st);
+ cache.put(SeaState.class, st);
- SpeciesBean sp;
+ Species sp;
- sp = new SpeciesBean();
+ sp = new Species();
sp.setId(UUID.randomUUID().toString());
sp.setCodeMemo("BAR");
sp.setGenusSpecies("Bar");
- cache.put(SpeciesBean.class, sp);
+ cache.put(Species.class, sp);
- sp = new SpeciesBean();
+ sp = new Species();
sp.setId(UUID.randomUUID().toString());
sp.setCodeMemo("CHIN");
sp.setGenusSpecies("Chinchard");
- cache.put(SpeciesBean.class, sp);
+ cache.put(Species.class, sp);
- sp = new SpeciesBean();
+ sp = new Species();
sp.setId(UUID.randomUUID().toString());
sp.setCodeMemo("FLE");
sp.setGenusSpecies("Flet");
- cache.put(SpeciesBean.class, sp);
+ cache.put(Species.class, sp);
- sp = new SpeciesBean();
+ sp = new Species();
sp.setId(UUID.randomUUID().toString());
sp.setCodeMemo("LIM");
sp.setGenusSpecies("Limande");
- cache.put(SpeciesBean.class, sp);
+ cache.put(Species.class, sp);
- SexBean se;
- se = new SexBean();
+ Sex se;
+ se = new Sex();
se.setId(UUID.randomUUID().toString());
se.setName("Male");
- cache.put(SexBean.class, se);
+ cache.put(Sex.class, se);
- se = new SexBean();
+ se = new Sex();
se.setId(UUID.randomUUID().toString());
se.setName("Femelle");
- cache.put(SexBean.class, se);
+ cache.put(Sex.class, se);
- se = new SexBean();
+ se = new Sex();
se.setId(UUID.randomUUID().toString());
se.setName("Indéterminé");
- cache.put(SexBean.class, se);
+ cache.put(Sex.class, se);
- WeightCategoryBean wc;
+ WeightCategory wc;
- wc = new WeightCategoryBean();
+ wc = new WeightCategory();
wc.setId(UUID.randomUUID().toString());
wc.setName("Petit");
- cache.put(WeightCategoryBean.class, wc);
+ cache.put(WeightCategory.class, wc);
- wc = new WeightCategoryBean();
+ wc = new WeightCategory();
wc.setId(UUID.randomUUID().toString());
wc.setName("Gros");
- cache.put(WeightCategoryBean.class, wc);
+ cache.put(WeightCategory.class, wc);
}
- public List<ZoneBean> zone() {
- return getData(ZoneBean.class);
+ public List<Zone> zone() {
+ return getData(Zone.class);
}
- public List<CountryBean> country() {
- return getData(CountryBean.class);
+ public List<Country> country() {
+ return getData(Country.class);
}
- public List<VesselBean> vessel() {
- return getData(VesselBean.class);
+ public List<Vessel> vessel() {
+ return getData(Vessel.class);
}
- public List<GearBean> gear() {
- return getData(GearBean.class);
+ public List<Gear> gear() {
+ return getData(Gear.class);
}
- public List<UserBean> user() {
- return getData(UserBean.class);
+ public List<TuttiUser> user() {
+ return getData(TuttiUser.class);
}
- public List<StrataBean> strata() {
- return getData(StrataBean.class);
+ public List<Strata> strata() {
+ return getData(Strata.class);
}
- public List<SeaStateBean> seaState() {
- return getData(SeaStateBean.class);
+ public List<SeaState> seaState() {
+ return getData(SeaState.class);
}
- public List<BeaufortScaleBean> beaufortScale() {
- return getData(BeaufortScaleBean.class);
+ public List<BeaufortScale> beaufortScale() {
+ return getData(BeaufortScale.class);
}
- public List<SpeciesBean> species() {
- return getData(SpeciesBean.class);
+ public List<Species> species() {
+ return getData(Species.class);
}
- public List<SexBean> sex() {
- return getData(SexBean.class);
+ public List<Sex> sex() {
+ return getData(Sex.class);
}
- public List<WeightCategoryBean> weightCategory() {
- return getData(WeightCategoryBean.class);
+ public List<WeightCategory> weightCategory() {
+ return getData(WeightCategory.class);
}
- protected <B extends AbstractTuttiBean> List<B> getData(Class<B> entityType) {
+ protected <B extends AbstractTuttiEntity> List<B> getData(Class<B> entityType) {
List<B> result = (List<B>) cache.get(entityType);
return result;
}
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,33 +25,35 @@
*/
+import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.config.TuttiPersistenceDevConfig;
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.StrataBean;
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitCatchBeanAware;
-import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.TuttiBeans;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
-import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
-import fr.ifremer.tutti.persistence.entities.referential.GearBean;
-import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
-import fr.ifremer.tutti.persistence.entities.referential.SexBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.persistence.entities.referential.UserBean;
-import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
-import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
+import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.data.Strata;
+import fr.ifremer.tutti.persistence.entities.data.Survey;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.data.TraitAware;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.SeaState;
+import fr.ifremer.tutti.persistence.entities.referential.Sex;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
+import fr.ifremer.tutti.persistence.entities.referential.Zone;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
@@ -66,6 +68,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;
+import java.util.Map;
import java.util.UUID;
/**
@@ -80,35 +83,41 @@
private static final Log log =
LogFactory.getLog(TuttiPersistenceDevImpl.class);
- protected final ArrayListMultimap<Class<? extends AbstractTuttiBean>, AbstractTuttiBean> cache = ArrayListMultimap.create();
+ protected final ArrayListMultimap<Class<? extends AbstractTuttiEntity>, AbstractTuttiEntity> cache = ArrayListMultimap.create();
- public static final List<Class<? extends AbstractTuttiBean>> TYPES = Lists.newArrayList(
- BeaufortScaleBean.class,
- CampaignBean.class,
- CountryBean.class,
- GearBean.class,
- SeaStateBean.class,
- SexBean.class,
- SpeciesBean.class,
- SurveyBean.class,
- TraitBean.class,
- TraitBenthosCatchBean.class,
- TraitSpeciesCatchBean.class,
- TraitPlanctonCatchBean.class,
- TraitMacroDechetCatchBean.class,
- TraitCaptureAccidentelCatchBean.class,
- UserBean.class,
- VesselBean.class,
- WeightCategoryBean.class,
- ZoneBean.class
+ public static final List<Class<? extends AbstractTuttiEntity>> TYPES = Lists.newArrayList(
+ BeaufortScale.class,
+ Campaign.class,
+ Country.class,
+ Gear.class,
+ SeaState.class,
+ Sex.class,
+ Species.class,
+ Survey.class,
+ Trait.class,
+ BenthosBatch.class,
+ SpeciesBatch.class,
+ SpeciesBatchFrequency.class,
+ PlanctonBatch.class,
+ MacroDechetBatch.class,
+ AccidentelBatch.class,
+ TuttiUser.class,
+ Vessel.class,
+ WeightCategory.class,
+ Zone.class
);
+ protected TuttiPersistenceDevConfig config;
+
+ //------------------------------------------------------------------------//
+ //-- Technical methods --//
+ //------------------------------------------------------------------------//
+
@Override
public String getImplementationName() {
return "Persistence Dev implementation";
}
- protected TuttiPersistenceDevConfig config;
@Override
public void open(ApplicationConfig config) throws IOException {
@@ -125,7 +134,7 @@
TuttiPersistenceDevFixtures fixtures =
new TuttiPersistenceDevFixtures();
- for (Class<? extends AbstractTuttiBean> entityType : TYPES) {
+ for (Class<? extends AbstractTuttiEntity> entityType : TYPES) {
loadEntities(entityType, fixtures);
}
}
@@ -133,89 +142,122 @@
@Override
public void close() throws IOException {
- for (Class<? extends AbstractTuttiBean> entityType : cache.keySet()) {
+ for (Class<? extends AbstractTuttiEntity> entityType : cache.keySet()) {
persistToFile(entityType);
}
}
+ //------------------------------------------------------------------------//
+ //-- Referential methods --//
+ //------------------------------------------------------------------------//
+
@Override
- public List<WeightCategoryBean> getAllWeightCategories() {
- List<WeightCategoryBean> result = getDataInNewList(WeightCategoryBean.class);
+ public List<WeightCategory> getAllWeightCategory() {
+ List<WeightCategory> result =
+ getDataInNewList(WeightCategory.class);
return result;
}
@Override
- public List<SexBean> getAllSex() {
- List<SexBean> result = getDataInNewList(SexBean.class);
+ public List<Sex> getAllSex() {
+ List<Sex> result = getDataInNewList(Sex.class);
return result;
}
@Override
- public List<SpeciesBean> getAllSpecies() {
- List<SpeciesBean> result = getDataInNewList(SpeciesBean.class);
+ public List<Species> getAllSpecies() {
+ List<Species> result = getDataInNewList(Species.class);
return result;
}
@Override
- public List<SurveyBean> getAllSurveys() {
- List<SurveyBean> result = getDataInNewList(SurveyBean.class);
+ public List<Zone> getAllZone() {
+ List<Zone> result = getDataInNewList(Zone.class);
return result;
}
@Override
- public List<ZoneBean> getAllZones() {
- List<ZoneBean> result = getDataInNewList(ZoneBean.class);
+ public List<Country> getAllCountry() {
+ List<Country> result = getDataInNewList(Country.class);
return result;
}
@Override
- public List<CountryBean> getAllCountries() {
- List<CountryBean> result = getDataInNewList(CountryBean.class);
+ public List<Vessel> getAllVessel() {
+ List<Vessel> result = getDataInNewList(Vessel.class);
return result;
}
@Override
- public List<VesselBean> getAllVessels() {
- List<VesselBean> result = getDataInNewList(VesselBean.class);
+ public List<Gear> getAllGear() {
+ List<Gear> result = getDataInNewList(Gear.class);
return result;
}
@Override
- public List<GearBean> getAllGears() {
- List<GearBean> result = getDataInNewList(GearBean.class);
+ public List<TuttiUser> getAllTuttiUser() {
+ List<TuttiUser> result = getDataInNewList(TuttiUser.class);
return result;
}
+ @Override
+ public List<SeaState> getAllSeaState() {
+ List<SeaState> result = getDataInNewList(SeaState.class);
+ return result;
+ }
@Override
- public List<UserBean> getAllUsers() {
- List<UserBean> result = getDataInNewList(UserBean.class);
+ public List<Strata> getAllStrata() {
+ List<Strata> result = getDataInNewList(Strata.class);
return result;
}
@Override
- public List<SeaStateBean> getAllSeaStates() {
- List<SeaStateBean> result = getDataInNewList(SeaStateBean.class);
+ public List<BeaufortScale> getAllBeaufortScale() {
+ List<BeaufortScale> result =
+ getDataInNewList(BeaufortScale.class);
return result;
}
+
+ //------------------------------------------------------------------------//
+ //-- Survey methods --//
+ //------------------------------------------------------------------------//
+
@Override
- public List<StrataBean> getAllStratas() {
- List<StrataBean> result = getDataInNewList(StrataBean.class);
+ public List<Survey> getAllSurvey() {
+ List<Survey> result = getDataInNewList(Survey.class);
return result;
}
@Override
- public List<BeaufortScaleBean> getAllBeaufortScales() {
- List<BeaufortScaleBean> result = getDataInNewList(BeaufortScaleBean.class);
+ public Survey getSurvey(String surveyId) {
+ Survey result = getBean(Survey.class, surveyId);
return result;
}
@Override
- public List<CampaignBean> getAllCampaigns(final String surveyId) {
- List<CampaignBean> result = Lists.newArrayList(Iterables.filter(getData(CampaignBean.class), new Predicate<CampaignBean>() {
+ public Survey createSurvey(Survey bean) {
+ Survey result = create(Survey.class, bean);
+ return result;
+ }
+
+ @Override
+ public Survey saveSurvey(Survey bean) {
+ Survey result = save(Survey.class, bean);
+ return result;
+ }
+
+
+ //------------------------------------------------------------------------//
+ //-- Campaign methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public List<Campaign> getAllCampaign(final String surveyId) {
+ List<Campaign> result = Lists.newArrayList(Iterables.filter(getData(Campaign.class), new Predicate<Campaign>() {
@Override
- public boolean apply(CampaignBean input) {
+ public boolean apply(Campaign input) {
return surveyId.equals(input.getSurvey().getId());
}
}));
@@ -223,10 +265,32 @@
}
@Override
- public List<TraitBean> getAllTraits(final String campaignId) {
- List<TraitBean> result = Lists.newArrayList(Iterables.filter(getData(TraitBean.class), new Predicate<TraitBean>() {
+ public Campaign getCampaign(String campaignId) {
+ Campaign result = getBean(Campaign.class, campaignId);
+ return result;
+ }
+
+ @Override
+ public Campaign createCampaign(Campaign bean) {
+ Campaign result = create(Campaign.class, bean);
+ return result;
+ }
+
+ @Override
+ public Campaign saveCampaign(Campaign bean) {
+ Campaign result = save(Campaign.class, bean);
+ return result;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Trait methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public List<Trait> getAllTrait(final String campaignId) {
+ List<Trait> result = Lists.newArrayList(Iterables.filter(getData(Trait.class), new Predicate<Trait>() {
@Override
- public boolean apply(TraitBean input) {
+ public boolean apply(Trait input) {
return campaignId.equals(input.getCampaign().getId());
}
}));
@@ -234,113 +298,225 @@
}
@Override
- public List<TraitSpeciesCatchBean> getAllTraitSpeciesCatch(final String traitId) {
- return getAllTraitFilterCatches(TraitSpeciesCatchBean.class, traitId);
+ public Trait getTrait(String traitId) {
+ Trait result = TuttiEntities.findById(getData(Trait.class), traitId);
+ return result;
}
@Override
- public List<TraitBenthosCatchBean> getAllTraitBenthosCatch(String traitId) {
- return getAllTraitFilterCatches(TraitBenthosCatchBean.class, traitId);
+ public Trait createTrait(Trait bean) {
+ Trait result = create(Trait.class, bean);
+ return result;
}
@Override
- public List<TraitPlanctonCatchBean> getAllTraitPlanctonCatch(String traitId) {
- return getAllTraitFilterCatches(TraitPlanctonCatchBean.class, traitId);
+ public Trait saveTrait(Trait bean) {
+ Trait result = save(Trait.class, bean);
+ return result;
}
+ //------------------------------------------------------------------------//
+ //-- Species Batch methods --//
+ //------------------------------------------------------------------------//
+
@Override
- public List<TraitMacroDechetCatchBean> getAllTraitMacroDechetCatch(String traitId) {
- return getAllTraitFilterCatches(TraitMacroDechetCatchBean.class, traitId);
+ public List<SpeciesBatch> getAllSpeciesBatch(final String traitId) {
+ List<SpeciesBatch> result = getAllTraitFilterBatches(
+ SpeciesBatch.class, traitId);
+ return result;
}
@Override
- public List<TraitCaptureAccidentelCatchBean> getAllTraitCaptureAccidentelCatch(String traitId) {
- return getAllTraitFilterCatches(TraitCaptureAccidentelCatchBean.class, traitId);
+ public SpeciesBatch getSpeciesBatch(String id) {
+ SpeciesBatch result = getBean(SpeciesBatch.class, id);
+ return result;
}
@Override
- public SurveyBean getSurvey(String surveyId) {
- SurveyBean result = TuttiBeans.findById(getData(SurveyBean.class), surveyId);
+ public SpeciesBatch createSpeciesBatch(SpeciesBatch bean) {
+ SpeciesBatch result = create(SpeciesBatch.class, bean);
return result;
}
@Override
- public CampaignBean getCampaign(String campaignId) {
- CampaignBean result = TuttiBeans.findById(getData(CampaignBean.class), campaignId);
+ public SpeciesBatch saveSpeciesBatch(SpeciesBatch bean) {
+ SpeciesBatch result = save(SpeciesBatch.class, bean);
return result;
}
@Override
- public TraitBean getTrait(String traitId) {
- TraitBean result = TuttiBeans.findById(getData(TraitBean.class), traitId);
+ public List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(final String speciesBatchId) {
+ List<SpeciesBatchFrequency> result = Lists.newArrayList(Iterables.filter(getData(SpeciesBatchFrequency.class), new Predicate<SpeciesBatchFrequency>() {
+ @Override
+ public boolean apply(SpeciesBatchFrequency input) {
+ return speciesBatchId.equals(input.getBatch().getId());
+ }
+ }));
return result;
}
@Override
- public TraitSpeciesCatchBean getTraitSpeciesCatch(String id) {
- TraitSpeciesCatchBean result = TuttiBeans.findById(getData(TraitSpeciesCatchBean.class), id);
+ public List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId,
+ List<SpeciesBatchFrequency> frequencies) {
+
+ // get back existing data
+ List<SpeciesBatchFrequency> existingData =
+ getAllSpeciesBatchFrequency(speciesBatchId);
+
+ // index them by id
+ Map<String, SpeciesBatchFrequency> existingById =
+ TuttiEntities.splitById(existingData);
+
+ List<SpeciesBatchFrequency> result = Lists.newArrayList();
+
+ for (SpeciesBatchFrequency toSave : frequencies) {
+
+ SpeciesBatchFrequency saved;
+
+ if (TuttiEntities.isNew(toSave)) {
+
+ // must create it
+ saved = new SpeciesBatchFrequency();
+ } else {
+
+ // get existing data
+ saved = existingById.get(toSave.getId());
+ }
+
+ // persist it
+ persist(SpeciesBatchFrequency.class, toSave, saved);
+
+ // store it back in result
+ result.add(saved);
+ }
+
return result;
}
+ //------------------------------------------------------------------------//
+ //-- Benthos Batch methods --//
+ //------------------------------------------------------------------------//
+
@Override
- public SurveyBean createSurvey(SurveyBean bean) {
- SurveyBean result = new SurveyBean();
- persist(SurveyBean.class, bean, result);
+ public List<BenthosBatch> getAllBenthosBatch(String traitId) {
+ List<BenthosBatch> result = getAllTraitFilterBatches(
+ BenthosBatch.class, traitId);
return result;
}
@Override
- public SurveyBean saveSurvey(SurveyBean bean) {
- SurveyBean result = getSurvey(bean.getId());
- persist(SurveyBean.class, bean, result);
+ public BenthosBatch getBenthosBatch(String id) {
+ BenthosBatch result = getBean(BenthosBatch.class, id);
return result;
}
@Override
- public CampaignBean createCampaign(CampaignBean bean) {
- CampaignBean result = new CampaignBean();
- persist(CampaignBean.class, bean, result);
+ public BenthosBatch createBenthosBatch(BenthosBatch bean) {
+ BenthosBatch result = create(BenthosBatch.class, bean);
return result;
}
@Override
- public CampaignBean saveCampaign(CampaignBean bean) {
- CampaignBean result = getCampaign(bean.getId());
- persist(CampaignBean.class, bean, result);
+ public BenthosBatch saveBenthosBatch(BenthosBatch bean) {
+ BenthosBatch result = save(BenthosBatch.class, bean);
return result;
}
+ //------------------------------------------------------------------------//
+ //-- Plancton Batch methods --//
+ //------------------------------------------------------------------------//
+
@Override
- public TraitBean createTrait(TraitBean bean) {
- TraitBean result = new TraitBean();
- persist(TraitBean.class, bean, result);
+ public List<PlanctonBatch> getAllPlanctonBatch(String traitId) {
+ List<PlanctonBatch> result = getAllTraitFilterBatches(
+ PlanctonBatch.class, traitId);
return result;
+
}
@Override
- public TraitBean saveTrait(TraitBean bean) {
- TraitBean result = getTrait(bean.getId());
- persist(TraitBean.class, bean, result);
+ public PlanctonBatch getPlanctonBatch(String id) {
+ PlanctonBatch result = getBean(PlanctonBatch.class, id);
return result;
}
@Override
- public TraitSpeciesCatchBean createTraitSpeciesCatch(TraitSpeciesCatchBean bean) {
- TraitSpeciesCatchBean result = new TraitSpeciesCatchBean();
- persist(TraitSpeciesCatchBean.class, bean, result);
+ public PlanctonBatch createPlanctonBatch(PlanctonBatch bean) {
+ PlanctonBatch result = create(PlanctonBatch.class, bean);
return result;
}
@Override
- public TraitSpeciesCatchBean saveTraitSpeciesCatch(TraitSpeciesCatchBean bean) {
- TraitSpeciesCatchBean result = getTraitSpeciesCatch(bean.getId());
- persist(TraitSpeciesCatchBean.class, bean, result);
+ public PlanctonBatch savePlanctonBatch(PlanctonBatch bean) {
+ PlanctonBatch result = save(PlanctonBatch.class, bean);
return result;
}
- protected <B extends AbstractTuttiBean> void persist(Class<B> beanType,
- B source, B target) {
+ //------------------------------------------------------------------------//
+ //-- Macrodechet Batch methods --//
+ //------------------------------------------------------------------------//
+ @Override
+ public List<MacroDechetBatch> getAllMacroDechetBatch(String traitId) {
+ List<MacroDechetBatch> result = getAllTraitFilterBatches(
+ MacroDechetBatch.class, traitId);
+ return result;
+ }
+
+ @Override
+ public MacroDechetBatch getMacroDechetBatch(String id) {
+ MacroDechetBatch result = getBean(MacroDechetBatch.class, id);
+ return result;
+ }
+
+ @Override
+ public MacroDechetBatch createMacroDechetBatch(MacroDechetBatch bean) {
+ MacroDechetBatch result = create(MacroDechetBatch.class, bean);
+ return result;
+ }
+
+ @Override
+ public MacroDechetBatch saveMacroDechetBatch(MacroDechetBatch bean) {
+ MacroDechetBatch result = save(MacroDechetBatch.class, bean);
+ return result;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Accidentel Batch methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public List<AccidentelBatch> getAllAccidentelBatch(String traitId) {
+ List<AccidentelBatch> result = getAllTraitFilterBatches(
+ AccidentelBatch.class, traitId);
+ return result;
+ }
+
+ @Override
+ public AccidentelBatch getAccidentelBatch(String id) {
+ AccidentelBatch result = getBean(AccidentelBatch.class, id);
+ return result;
+ }
+
+ @Override
+ public AccidentelBatch createAccidentelBatch(AccidentelBatch bean) {
+ AccidentelBatch result = create(AccidentelBatch.class, bean);
+ return result;
+ }
+
+ @Override
+ public AccidentelBatch saveAccidentelBatch(AccidentelBatch bean) {
+ AccidentelBatch result = save(AccidentelBatch.class, bean);
+ return result;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+ protected <B extends AbstractTuttiEntity> void persist(Class<B> beanType,
+ B source, B target) {
+
BinderFactory.newBinder(beanType).copyExcluding(
source, target, "id");
if (source.getId() == null) {
@@ -352,8 +528,8 @@
persistToFile(beanType);
}
- protected <B extends AbstractTuttiBean> List<B> loadEntities(Class<B> entityType,
- TuttiPersistenceDevFixtures fix
+ protected <B extends AbstractTuttiEntity> List<B> loadEntities(Class<B> entityType,
+ TuttiPersistenceDevFixtures fix
) throws IOException {
File storageFile = getStorageFile(entityType);
@@ -390,8 +566,8 @@
return result;
}
- protected <B extends AbstractTuttiBean> List<B> loadEntities(Class<B> entityType,
- List<B> defaultList) throws IOException {
+ protected <B extends AbstractTuttiEntity> List<B> loadEntities(Class<B> entityType,
+ List<B> defaultList) throws IOException {
File storageFile = getStorageFile(entityType);
List<B> result;
@@ -432,7 +608,7 @@
return result;
}
- protected <B extends AbstractTuttiBean> void persistToFile(Class<B> entityType) {
+ protected <B extends AbstractTuttiEntity> void persistToFile(Class<B> entityType) {
List<B> entities = getDataInNewList(entityType);
File storageFile = getStorageFile(entityType);
@@ -456,19 +632,41 @@
}
}
- protected <B extends AbstractTuttiBean> List<B> getData(Class<B> entityType) {
+ protected <B extends AbstractTuttiEntity> List<B> getData(Class<B> entityType) {
List<B> result = (List<B>) cache.get(entityType);
return result;
}
- protected <B extends AbstractTuttiBean> List<B> getDataInNewList(Class<B> entityType) {
+ protected <B extends AbstractTuttiEntity> List<B> getDataInNewList(Class<B> entityType) {
List<B> result = getData(entityType);
return Lists.newArrayList(result);
}
- protected <B extends AbstractTuttiBean & TraitCatchBeanAware> List<B> getAllTraitFilterCatches(Class<B> beanType, String traitId) {
- List<B> result = Lists.newArrayList(Iterables.filter(getData(beanType), TuttiBeans.newTraitIdPredicate(traitId)));
+ protected <B extends AbstractTuttiEntity & TraitAware> List<B> getAllTraitFilterBatches(Class<B> beanType, String traitId) {
+ Predicate<B> predicate = TuttiEntities.newTraitIdPredicate(traitId);
+ List<B> result = Lists.newArrayList(Iterables.filter(getData(beanType), predicate));
return result;
}
+ protected <B extends AbstractTuttiEntity> B create(Class<B> type, B bean) {
+ Preconditions.checkNotNull(bean, "Can't persist a null bean");
+ B result = TuttiEntities.newEntity(bean);
+ persist(type, bean, result);
+ return result;
+ }
+
+ protected <B extends AbstractTuttiEntity> B save(Class<B> type, B bean) {
+ Preconditions.checkNotNull(bean, "Can't persist a null bean");
+ String id = bean.getId();
+ Preconditions.checkNotNull(id, "Can't save a bean with null id");
+ B result = getBean(type, id);
+ persist(type, bean, result);
+ return result;
+ }
+
+ protected <B extends AbstractTuttiEntity> B getBean(Class<B> type, String id) {
+ B result = TuttiEntities.findById(getData(type), id);
+ return result;
+ }
+
}
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfigOption.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfigOption.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfigOption.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -37,11 +37,11 @@
public enum TuttiPersistenceDevConfigOption implements ApplicationConfig.OptionDef {
STORAGE_DIRECTORY("tutti.persistence.storageDirectory",
- "Répertoire où sont stoquées les données",
- "${tutti.data.directory}/devStorage",
- File.class,
- true,
- true
+ "Répertoire où sont stoquées les données",
+ "${tutti.data.directory}/devStorage",
+ File.class,
+ true,
+ true
);
/** Configuration key. */
Modified: trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java
===================================================================
--- trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,7 +25,7 @@
*/
import fr.ifremer.tutti.persistence.config.TuttiPersistenceDevConfig;
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
+import fr.ifremer.tutti.persistence.entities.data.Survey;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -84,7 +84,7 @@
Assert.assertTrue(storageDirectory.exists());
TuttiPersistenceDevFixtures fixtures = new TuttiPersistenceDevFixtures();
- Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaStates().size());
+ Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaState().size());
}
@Test
@@ -97,11 +97,11 @@
persistence.open(config.getConfig());
TuttiPersistenceDevFixtures fixtures = new TuttiPersistenceDevFixtures();
- Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaStates().size());
+ Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaState().size());
persistence.close();
Assert.assertTrue(storageDirectory.exists());
- Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaStates().size());
+ Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaState().size());
}
@Test
@@ -114,12 +114,12 @@
persistence.open(config.getConfig());
Assert.assertTrue(storageDirectory.exists());
- int size = persistence.getAllSurveys().size();
+ int size = persistence.getAllSurvey().size();
- SurveyBean s = new SurveyBean();
+ Survey s = new Survey();
s.setId("46de4ba5-3be6-4ab6-9f39-586b8e491fda");
s.setName("Serie 3");
- s.setZone(persistence.getAllZones().get(0));
+ s.setZone(persistence.getAllZone().get(0));
persistence.createSurvey(s);
@@ -128,7 +128,7 @@
persistence.open(config.getConfig());
- Assert.assertEquals(size + 1, persistence.getAllSurveys().size());
+ Assert.assertEquals(size + 1, persistence.getAllSurvey().size());
}
public static File getTestSpecificDirectory(Class<?> testClassName,
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,20 +24,20 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.StrataBean;
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
-import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
-import fr.ifremer.tutti.persistence.entities.referential.GearBean;
-import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
-import fr.ifremer.tutti.persistence.entities.referential.SexBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.persistence.entities.referential.UserBean;
-import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
-import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
+import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.Strata;
+import fr.ifremer.tutti.persistence.entities.data.Survey;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.SeaState;
+import fr.ifremer.tutti.persistence.entities.referential.Sex;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
+import fr.ifremer.tutti.persistence.entities.referential.Zone;
import org.nuiton.util.decorator.Decorator;
import org.nuiton.util.decorator.DecoratorProvider;
@@ -55,7 +55,7 @@
public static final String SPECIES_BY_GENUS = "byGenus";
- public static final String BY_NAME= "byName";
+ public static final String BY_NAME = "byName";
/** Delegate decorator provider. */
protected DecoratorProvider decoratorProvider;
@@ -84,23 +84,23 @@
@Override
protected void loadDecorators() {
- registerMultiJXPathDecorator(SurveyBean.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(CampaignBean.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(TraitBean.class, "${stationNumber}$s#${traitNumber}$s#${date}$td/%3$tm/%3$tY", "#", " - ");
- registerMultiJXPathDecorator(ZoneBean.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(VesselBean.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(CountryBean.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(GearBean.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(UserBean.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(BeaufortScaleBean.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(SeaStateBean.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(StrataBean.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(SexBean.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(SpeciesBean.class, "${codeMemo}#${genusSpecies}$s", "#", " - ");
- registerJXPathDecorator(SpeciesBean.class, SPECIES_BY_CODE, "${codeMemo}$s");
- registerJXPathDecorator(SpeciesBean.class, SPECIES_BY_GENUS, "${genusSpecies}$s");
- registerJXPathDecorator(WeightCategoryBean.class, BY_NAME, "${name}$s");
- registerJXPathDecorator(SexBean.class, BY_NAME, "${name}$s");
+ registerMultiJXPathDecorator(Survey.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(Campaign.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(Trait.class, "${stationNumber}$s#${traitNumber}$s#${date}$td/%3$tm/%3$tY", "#", " - ");
+ registerMultiJXPathDecorator(Zone.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(Vessel.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(Country.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(Gear.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(TuttiUser.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(BeaufortScale.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(SeaState.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(Strata.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(Sex.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(Species.class, "${codeMemo}#${genusSpecies}$s", "#", " - ");
+ registerJXPathDecorator(Species.class, SPECIES_BY_CODE, "${codeMemo}$s");
+ registerJXPathDecorator(Species.class, SPECIES_BY_GENUS, "${genusSpecies}$s");
+ registerJXPathDecorator(WeightCategory.class, BY_NAME, "${name}$s");
+ registerJXPathDecorator(Sex.class, BY_NAME, "${name}$s");
}
};
}
@@ -109,17 +109,17 @@
n_("tutti.property.name");
n_("tutti.property.stationNumber");
n_("tutti.property.date");
- n_("tutti.property.surveyBean");
- n_("tutti.property.campaignBean");
- n_("tutti.property.traitBean");
- n_("tutti.property.zoneBean");
- n_("tutti.property.vesselBean");
- n_("tutti.property.countryBean");
- n_("tutti.property.gearBean");
- n_("tutti.property.userBean");
- n_("tutti.property.beaufortScaleBean");
- n_("tutti.property.seaStateBean");
- n_("tutti.property.strataBean");
+ n_("tutti.property.survey");
+ n_("tutti.property.campaign");
+ n_("tutti.property.trait");
+ n_("tutti.property.zone");
+ n_("tutti.property.vessel");
+ n_("tutti.property.country");
+ n_("tutti.property.gear");
+ n_("tutti.property.user");
+ n_("tutti.property.beaufortScale");
+ n_("tutti.property.seaState");
+ n_("tutti.property.strata");
n_("tutti.property.codeMemo");
n_("tutti.property.genusSpecies");
}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -26,25 +26,26 @@
import com.google.common.base.Preconditions;
import fr.ifremer.tutti.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.StrataBean;
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
-import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
-import fr.ifremer.tutti.persistence.entities.referential.GearBean;
-import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
-import fr.ifremer.tutti.persistence.entities.referential.SexBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.persistence.entities.referential.UserBean;
-import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
-import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
+import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
+import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.data.Strata;
+import fr.ifremer.tutti.persistence.entities.data.Survey;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.SeaState;
+import fr.ifremer.tutti.persistence.entities.referential.Sex;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
+import fr.ifremer.tutti.persistence.entities.referential.Zone;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.ApplicationConfig;
@@ -79,7 +80,17 @@
}
}
+ //------------------------------------------------------------------------//
+ //-- Technical methods --//
+ //------------------------------------------------------------------------//
+
@Override
+ public String getImplementationName() {
+ checkDriverExists();
+ return driver.getImplementationName();
+ }
+
+ @Override
public void open(ApplicationConfig config) throws IOException {
ServiceLoader<TuttiPersistence> loader =
@@ -117,198 +128,318 @@
driver.close();
}
+ //------------------------------------------------------------------------//
+ //-- Referential methods --//
+ //------------------------------------------------------------------------//
+
@Override
- public List<WeightCategoryBean> getAllWeightCategories() {
+ public List<WeightCategory> getAllWeightCategory() {
checkDriverExists();
- return driver.getAllWeightCategories();
+ return driver.getAllWeightCategory();
}
@Override
- public List<SexBean> getAllSex() {
+ public List<Sex> getAllSex() {
checkDriverExists();
return driver.getAllSex();
}
@Override
- public List<SpeciesBean> getAllSpecies() {
+ public List<Species> getAllSpecies() {
checkDriverExists();
return driver.getAllSpecies();
}
@Override
- public String getImplementationName() {
+ public List<Zone> getAllZone() {
checkDriverExists();
- return driver.getImplementationName();
+ return driver.getAllZone();
}
@Override
- public List<SurveyBean> getAllSurveys() {
+ public List<Country> getAllCountry() {
checkDriverExists();
- return driver.getAllSurveys();
+ return driver.getAllCountry();
}
@Override
- public List<ZoneBean> getAllZones() {
+ public List<Vessel> getAllVessel() {
checkDriverExists();
- return driver.getAllZones();
+ return driver.getAllVessel();
}
@Override
- public List<CountryBean> getAllCountries() {
+ public List<Gear> getAllGear() {
checkDriverExists();
- return driver.getAllCountries();
+ return driver.getAllGear();
}
@Override
- public List<VesselBean> getAllVessels() {
+ public List<TuttiUser> getAllTuttiUser() {
checkDriverExists();
- return driver.getAllVessels();
+ return driver.getAllTuttiUser();
}
@Override
- public List<GearBean> getAllGears() {
+ public List<SeaState> getAllSeaState() {
checkDriverExists();
- return driver.getAllGears();
+ return driver.getAllSeaState();
}
@Override
- public List<UserBean> getAllUsers() {
+ public List<Strata> getAllStrata() {
checkDriverExists();
- return driver.getAllUsers();
+ return driver.getAllStrata();
}
@Override
- public List<SeaStateBean> getAllSeaStates() {
+ public List<BeaufortScale> getAllBeaufortScale() {
checkDriverExists();
- return driver.getAllSeaStates();
+ return driver.getAllBeaufortScale();
}
+ //------------------------------------------------------------------------//
+ //-- Survey methods --//
+ //------------------------------------------------------------------------//
+
@Override
- public List<StrataBean> getAllStratas() {
+ public List<Survey> getAllSurvey() {
checkDriverExists();
- return driver.getAllStratas();
+ return driver.getAllSurvey();
}
@Override
- public List<BeaufortScaleBean> getAllBeaufortScales() {
+ public Survey getSurvey(String surveyId) {
checkDriverExists();
- return driver.getAllBeaufortScales();
+ return driver.getSurvey(surveyId);
}
@Override
- public List<CampaignBean> getAllCampaigns(String surveyId) {
+ public Survey createSurvey(Survey bean) {
checkDriverExists();
- return driver.getAllCampaigns(surveyId);
+ return driver.createSurvey(bean);
}
@Override
- public List<TraitBean> getAllTraits(String campaignId) {
+ public Survey saveSurvey(Survey bean) {
checkDriverExists();
- return driver.getAllTraits(campaignId);
+ return driver.saveSurvey(bean);
}
+ //------------------------------------------------------------------------//
+ //-- Campaign methods --//
+ //------------------------------------------------------------------------//
+
@Override
- public List<TraitSpeciesCatchBean> getAllTraitSpeciesCatch(String traitId) {
+ public List<Campaign> getAllCampaign(String surveyId) {
checkDriverExists();
- return driver.getAllTraitSpeciesCatch(traitId);
+ return driver.getAllCampaign(surveyId);
}
@Override
- public List<TraitBenthosCatchBean> getAllTraitBenthosCatch(String traitId) {
+ public Campaign getCampaign(String campaignId) {
checkDriverExists();
- return driver.getAllTraitBenthosCatch(traitId);
+ return driver.getCampaign(campaignId);
}
@Override
- public List<TraitPlanctonCatchBean> getAllTraitPlanctonCatch(String traitId) {
+ public Campaign createCampaign(Campaign bean) {
checkDriverExists();
- return driver.getAllTraitPlanctonCatch(traitId);
+ return driver.createCampaign(bean);
}
@Override
- public List<TraitMacroDechetCatchBean> getAllTraitMacroDechetCatch(String traitId) {
+ public Campaign saveCampaign(Campaign bean) {
checkDriverExists();
- return driver.getAllTraitMacroDechetCatch(traitId);
+ return driver.saveCampaign(bean);
}
+ //------------------------------------------------------------------------//
+ //-- Trait methods --//
+ //------------------------------------------------------------------------//
+
@Override
- public List<TraitCaptureAccidentelCatchBean> getAllTraitCaptureAccidentelCatch(String traitId) {
+ public List<Trait> getAllTrait(String campaignId) {
checkDriverExists();
- return driver.getAllTraitCaptureAccidentelCatch(traitId);
+ return driver.getAllTrait(campaignId);
}
@Override
- public SurveyBean getSurvey(String surveyId) {
+ public Trait getTrait(String traitId) {
checkDriverExists();
- return driver.getSurvey(surveyId);
+ return driver.getTrait(traitId);
}
@Override
- public CampaignBean getCampaign(String campaignId) {
+ public Trait createTrait(Trait bean) {
checkDriverExists();
- return driver.getCampaign(campaignId);
+ return driver.createTrait(bean);
}
@Override
- public TraitBean getTrait(String traitId) {
+ public Trait saveTrait(Trait bean) {
checkDriverExists();
- return driver.getTrait(traitId);
+ return driver.saveTrait(bean);
}
+ //------------------------------------------------------------------------//
+ //-- Species Batch methods --//
+ //------------------------------------------------------------------------//
+
+
@Override
- public TraitSpeciesCatchBean getTraitSpeciesCatch(String id) {
+ public List<SpeciesBatch> getAllSpeciesBatch(String traitId) {
checkDriverExists();
- return driver.getTraitSpeciesCatch(id);
+ return driver.getAllSpeciesBatch(traitId);
}
@Override
- public SurveyBean createSurvey(SurveyBean bean) {
+ public SpeciesBatch getSpeciesBatch(String id) {
checkDriverExists();
- return driver.createSurvey(bean);
+ return driver.getSpeciesBatch(id);
}
@Override
- public SurveyBean saveSurvey(SurveyBean bean) {
+ public SpeciesBatch createSpeciesBatch(SpeciesBatch bean) {
checkDriverExists();
- return driver.saveSurvey(bean);
+ return driver.createSpeciesBatch(bean);
}
@Override
- public CampaignBean createCampaign(CampaignBean bean) {
+ public SpeciesBatch saveSpeciesBatch(SpeciesBatch bean) {
checkDriverExists();
- return driver.createCampaign(bean);
+ return driver.saveSpeciesBatch(bean);
}
@Override
- public CampaignBean saveCampaign(CampaignBean bean) {
+ public List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(String speciesBatchId) {
checkDriverExists();
- return driver.saveCampaign(bean);
+ return driver.getAllSpeciesBatchFrequency(speciesBatchId);
}
@Override
- public TraitBean createTrait(TraitBean bean) {
+ public List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId,
+ List<SpeciesBatchFrequency> frequencies) {
checkDriverExists();
- return driver.createTrait(bean);
+ return driver.saveSpeciesBatchFrequency(speciesBatchId, frequencies);
}
+ //------------------------------------------------------------------------//
+ //-- Benthos Batch methods --//
+ //------------------------------------------------------------------------//
+
@Override
- public TraitBean saveTrait(TraitBean bean) {
+ public List<BenthosBatch> getAllBenthosBatch(String traitId) {
checkDriverExists();
- return driver.saveTrait(bean);
+ return driver.getAllBenthosBatch(traitId);
}
@Override
- public TraitSpeciesCatchBean createTraitSpeciesCatch(TraitSpeciesCatchBean bean) {
+ public BenthosBatch getBenthosBatch(String id) {
checkDriverExists();
- return driver.createTraitSpeciesCatch(bean);
+ return driver.getBenthosBatch(id);
}
@Override
- public TraitSpeciesCatchBean saveTraitSpeciesCatch(TraitSpeciesCatchBean bean) {
+ public BenthosBatch createBenthosBatch(BenthosBatch bean) {
checkDriverExists();
- return driver.saveTraitSpeciesCatch(bean);
+ return driver.createBenthosBatch(bean);
}
+ @Override
+ public BenthosBatch saveBenthosBatch(BenthosBatch bean) {
+ checkDriverExists();
+ return driver.saveBenthosBatch(bean);
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Plancton Batch methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public List<PlanctonBatch> getAllPlanctonBatch(String traitId) {
+ checkDriverExists();
+ return driver.getAllPlanctonBatch(traitId);
+ }
+
+ @Override
+ public PlanctonBatch getPlanctonBatch(String id) {
+ checkDriverExists();
+ return driver.getPlanctonBatch(id);
+ }
+
+ @Override
+ public PlanctonBatch createPlanctonBatch(PlanctonBatch bean) {
+ checkDriverExists();
+ return driver.createPlanctonBatch(bean);
+ }
+
+ @Override
+ public PlanctonBatch savePlanctonBatch(PlanctonBatch bean) {
+ checkDriverExists();
+ return driver.savePlanctonBatch(bean);
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Macrodechet Batch methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public List<MacroDechetBatch> getAllMacroDechetBatch(String traitId) {
+ checkDriverExists();
+ return driver.getAllMacroDechetBatch(traitId);
+ }
+
+ @Override
+ public MacroDechetBatch getMacroDechetBatch(String id) {
+ checkDriverExists();
+ return driver.getMacroDechetBatch(id);
+ }
+
+ @Override
+ public MacroDechetBatch createMacroDechetBatch(MacroDechetBatch bean) {
+ checkDriverExists();
+ return driver.createMacroDechetBatch(bean);
+ }
+
+ @Override
+ public MacroDechetBatch saveMacroDechetBatch(MacroDechetBatch bean) {
+ checkDriverExists();
+ return driver.saveMacroDechetBatch(bean);
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Accidentel Batch methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public List<AccidentelBatch> getAllAccidentelBatch(String traitId) {
+ checkDriverExists();
+ return driver.getAllAccidentelBatch(traitId);
+ }
+
+ @Override
+ public AccidentelBatch getAccidentelBatch(String id) {
+ checkDriverExists();
+ return driver.getAccidentelBatch(id);
+ }
+
+ @Override
+ public AccidentelBatch createAccidentelBatch(AccidentelBatch bean) {
+ checkDriverExists();
+ return driver.createAccidentelBatch(bean);
+ }
+
+ @Override
+ public AccidentelBatch saveAccidentelBatch(AccidentelBatch bean) {
+ checkDriverExists();
+ return driver.saveAccidentelBatch(bean);
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
protected void checkDriverExists() {
Preconditions.checkNotNull(
driver,
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-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-12-06 17:03:05 UTC (rev 30)
@@ -3,20 +3,29 @@
tutti.config.data.directory=Répertoire de données de l'application. Vous pouvez utiliser l'expression ${tutti.data.directory} pour le référence dans d'autres propriétés de configuration (ex\: ${tutti.data.directory}/tmp).
tutti.config.license.organizationName=Nom de l'organisation dans la licence
tutti.config.tmp.directory=Répertoire temporaire utilisée par l'application (est nettoyé à chaque démarrage de l'application)
+tutti.property.beaufortScale=
tutti.property.beaufortScaleBean=Vent beaufort
+tutti.property.campaign=
tutti.property.campaignBean=Campagne
tutti.property.codeMemo=Code Memo
+tutti.property.country=
tutti.property.countryBean=Pays
tutti.property.date=Date
+tutti.property.gear=
tutti.property.gearBean=Engin
tutti.property.genusSpecies=Nom scientifique
tutti.property.name=Nom
+tutti.property.seaState=
tutti.property.seaStateBean=État de la mer
tutti.property.stationNumber=Numéro de station
-tutti.property.strataBean=Strate d'association
+tutti.property.strata=Strate d'association
+tutti.property.survey=
tutti.property.surveyBean=Série de campagne
-tutti.property.traitBean=Trait
+tutti.property.trait=Trait
+tutti.property.user=
tutti.property.userBean=Utilisateur
+tutti.property.vessel=
tutti.property.vesselBean=Navire
+tutti.property.zone=
tutti.property.zoneBean=Zone
tutti.service.config=Configuration des services de Tutti
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiBeanUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiBeanUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiBeanUIModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,7 +24,9 @@
* #L%
*/
+import fr.ifremer.tutti.service.TuttiServiceTechnicalException;
import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.Binder;
/**
* Abstract UI model to edit a bean.
@@ -32,11 +34,10 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public abstract class AbstractTuttiBeanUIModel extends AbstractSerializableBean {
+public abstract class AbstractTuttiBeanUIModel<E, B extends AbstractTuttiBeanUIModel<E, B>> extends AbstractSerializableBean {
private static final long serialVersionUID = 1L;
-
public static final String PROPERTY_ID = "id";
public static final String PROPERTY_MODIFY = "modify";
@@ -49,6 +50,41 @@
protected boolean valid;
+ private final Class<E> entityType;
+
+ private final Binder<E, B> fromBeanBinder;
+
+ private final Binder<B, E> toBeanBinder;
+
+ protected AbstractTuttiBeanUIModel(Class<E> entityType,
+ Binder<E, B> fromBeanBinder,
+ Binder<B, E> toBeanBinder) {
+ this.entityType = entityType;
+ this.fromBeanBinder = fromBeanBinder;
+ this.toBeanBinder = toBeanBinder;
+ }
+
+ public final void fromBean(E bean) {
+ fromBeanBinder.copy(bean, (B) this);
+ }
+
+ public final E toBean() {
+ E result = newEntity();
+ toBeanBinder.copy((B) this, result);
+ return result;
+ }
+
+ protected E newEntity() {
+ try {
+ E result = entityType.newInstance();
+ return result;
+ } catch (Exception e) {
+ throw new TuttiServiceTechnicalException(
+ "Could not instanciate entity of type " +
+ entityType.getName(), e);
+ }
+ }
+
public String getId() {
return id;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,11 +24,11 @@
* #L%
*/
-import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
import jaxx.runtime.swing.OneClicListSelectionModel;
@@ -37,7 +37,6 @@
import jaxx.runtime.swing.editor.bean.BeanComboBox;
import jaxx.runtime.swing.editor.bean.BeanListHeader;
import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
-import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXDatePicker;
@@ -50,7 +49,6 @@
import javax.swing.ListModel;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
-import javax.swing.table.TableCellRenderer;
import javax.swing.text.JTextComponent;
import java.awt.event.ItemEvent;
import java.awt.event.KeyEvent;
@@ -58,7 +56,6 @@
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -148,7 +145,7 @@
*
* @param comboBox le component graphique à initialiser
*/
- protected <E extends AbstractTuttiBean> void initBeanComboBox(
+ protected <E extends AbstractTuttiEntity> void initBeanComboBox(
BeanComboBox<E> comboBox,
List<E> data,
E selectedData) {
@@ -181,7 +178,7 @@
*
* @param listHeader le component graphique à initialiser
*/
- protected <E extends AbstractTuttiBean> void initBeanList(
+ protected <E extends AbstractTuttiEntity> void initBeanList(
BeanListHeader<E> listHeader,
List<E> data,
List<E> selectedData) {
@@ -233,26 +230,19 @@
picker.getEditor().setEditable(false);
}
- protected <B extends AbstractTuttiBean> void updateIndices(JList<B> jlist,
- List<B> list) {
+ protected <B extends AbstractTuttiEntity> void updateIndices(JList jlist,
+ List<B> list) {
- List<String> ids = list == null ?
- Collections.<String>emptyList() :
- Lists.transform(list, new Function<B, String>() {
- @Override
- public String apply(B input) {
- return input.getId();
- }
- });
+ List<String> ids = TuttiEntities.toIds(list);
List<Integer> indices = new ArrayList<Integer>();
if (list != null && !list.isEmpty()) {
- ListModel<B> model = jlist.getModel();
+ ListModel model = jlist.getModel();
for (int i = 0, max = model.getSize(); i < max; i++) {
- B s = model.getElementAt(i);
+ B s = (B) model.getElementAt(i);
if (ids.contains(s.getId())) {
indices.add(i);
}
@@ -300,27 +290,6 @@
return result;
}
- protected <O> TableCellRenderer newTableCellRender(Class<O> type) {
-
- return newTableCellRender(type, null);
- }
-
- protected <O> TableCellRenderer newTableCellRender(Class<O> type, String name) {
-
- Decorator<O> decorator = getDecorator(type, name);
-
- TableCellRenderer result = newTableCellRender(decorator);
- return result;
- }
-
- protected <O> TableCellRenderer newTableCellRender(Decorator<O> decorator) {
-
- Preconditions.checkNotNull(decorator);
-
- DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator);
- return result;
- }
-
protected void listenValidatorValid(SimpleBeanValidator validator,
final AbstractTuttiBeanUIModel model) {
validator.addPropertyChangeListener(SimpleBeanValidator.VALID_PROPERTY, new PropertyChangeListener() {
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-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,8 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
+import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.Survey;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.config.TuttiServiceConfigOption;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
@@ -442,7 +442,7 @@
// selected survey
- SurveyBean survey = persistenceService.getSurvey(surveyId);
+ Survey survey = persistenceService.getSurvey(surveyId);
title = _("tutti.title.selectedSurvey", survey.getName()) + " / ";
@@ -458,7 +458,7 @@
} else {
// selected campaign
- CampaignBean campaign;
+ Campaign campaign;
campaign = persistenceService.getCampaign(campaignId);
title += _("tutti.title.selectedCampaign", campaign.getName());
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -26,8 +26,8 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
+import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.Survey;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.TuttiService;
import fr.ifremer.tutti.service.TuttiServiceContext;
@@ -203,7 +203,7 @@
if (surveyId != null) {
- SurveyBean survey = persistenceService.getSurvey(surveyId);
+ Survey survey = persistenceService.getSurvey(surveyId);
if (survey == null) {
// not found in this db
@@ -224,7 +224,7 @@
// test campaignId
if (campaignId != null) {
- CampaignBean campaign =
+ Campaign campaign =
persistenceService.getCampaign(campaignId);
if (campaign != null &&
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css 2012-12-06 17:03:05 UTC (rev 30)
@@ -95,7 +95,7 @@
#vesselHeader {
labelText:{_("tutti.label.list.vessel")};
list:{vesselList};
- beanType:{VesselBean.class};
+ beanType:{Vessel.class};
}
#gearPane {
@@ -106,7 +106,7 @@
#gearHeader {
labelText:{_("tutti.label.list.gear")};
list:{gearList};
- beanType:{GearBean.class};
+ beanType:{Gear.class};
}
#headOfMissionPane {
@@ -117,7 +117,7 @@
#headOfMissionHeader {
labelText:{_("tutti.label.list.headOfMission")};
list:{headOfMissionList};
- beanType:{UserBean.class};
+ beanType:{TuttiUser.class};
}
#headOfSortRoomPane {
@@ -128,7 +128,7 @@
#headOfSortRoomHeader {
labelText:{_("tutti.label.list.headOfSortRoom")};
list:{headOfSortRoomList};
- beanType:{UserBean.class};
+ beanType:{TuttiUser.class};
}
#commentPane {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,11 +25,11 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditCampaignUIModel, EditCampaignUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.referential.CountryBean
- fr.ifremer.tutti.persistence.entities.referential.GearBean
- fr.ifremer.tutti.persistence.entities.SurveyBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
- fr.ifremer.tutti.persistence.entities.referential.VesselBean
+ fr.ifremer.tutti.persistence.entities.data.Survey
+ fr.ifremer.tutti.persistence.entities.referential.Country
+ fr.ifremer.tutti.persistence.entities.referential.Gear
+ fr.ifremer.tutti.persistence.entities.referential.TuttiUser
+ fr.ifremer.tutti.persistence.entities.referential.Vessel
fr.ifremer.tutti.ui.swing.TuttiUIContext
jaxx.runtime.swing.editor.bean.BeanComboBox
@@ -91,7 +91,7 @@
</cell>
<cell weightx='1.0'>
<BeanComboBox id='surveyComboBox' constructorParams='this'
- genericType='SurveyBean'/>
+ genericType='Survey'/>
</cell>
</row>
@@ -102,7 +102,7 @@
</cell>
<cell>
<BeanComboBox id='countryComboBox' constructorParams='this'
- genericType='CountryBean'/>
+ genericType='Country'/>
</cell>
</row>
@@ -136,13 +136,13 @@
onFocusGained='vesselList.requestFocus()'>
<JList id='vesselList'
onValueChanged='handler.selectListData(event, "vessel")'/>
- <BeanListHeader id='vesselHeader' genericType='VesselBean'/>
+ <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='GearBean'/>
+ <BeanListHeader id='gearHeader' genericType='Gear'/>
</JScrollPane>
</JPanel>
</cell>
@@ -159,7 +159,7 @@
<JList id='headOfMissionList'
onValueChanged='handler.selectListData(event, "headOfMission")'/>
<BeanListHeader id='headOfMissionHeader'
- genericType='UserBean'/>
+ genericType='TuttiUser'/>
</JScrollPane>
<JScrollPane id='headOfSortRoomPane'
columnHeaderView="{headOfSortRoomHeader}"
@@ -167,7 +167,7 @@
<JList id='headOfSortRoomList'
onValueChanged='handler.selectListData(event, "headOfSortRoom")'/>
<BeanListHeader id='headOfSortRoomHeader'
- genericType='UserBean'/>
+ genericType='TuttiUser'/>
</JScrollPane>
</JPanel>
</cell>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,10 +24,10 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
-import fr.ifremer.tutti.persistence.entities.TuttiBeans;
-import fr.ifremer.tutti.persistence.entities.referential.UserBean;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.Survey;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.TuttiScreen;
@@ -63,13 +63,13 @@
String campaignId = context.getCampaignId();
if (campaignId == null) {
- SurveyBean survey =
+ Survey survey =
persistenceService.getSurvey(context.getSurveyId());
model.setSurvey(survey);
} else {
// load existing survey
- CampaignBean campaign = persistenceService.getCampaign(campaignId);
+ Campaign campaign = persistenceService.getCampaign(campaignId);
model.fromBean(campaign);
}
@@ -80,24 +80,24 @@
@Override
public void afterInitUI() {
- List<UserBean> users = persistenceService.getAllUsers();
+ List<TuttiUser> users = persistenceService.getAllTuttiUser();
EditCampaignUIModel model = ui.getModel();
initBeanComboBox(ui.getSurveyComboBox(),
- persistenceService.getAllSurveys(),
+ persistenceService.getAllSurvey(),
model.getSurvey());
initBeanComboBox(ui.getCountryComboBox(),
- persistenceService.getAllCountries(),
+ persistenceService.getAllCountry(),
model.getCountry());
initBeanList(ui.getVesselHeader(),
- persistenceService.getAllVessels(),
+ persistenceService.getAllVessel(),
model.getVessel());
initBeanList(ui.getGearHeader(),
- persistenceService.getAllGears(),
+ persistenceService.getAllGear(),
model.getGear());
initBeanList(ui.getHeadOfMissionHeader(),
@@ -135,10 +135,10 @@
EditCampaignUIModel model = ui.getModel();
- CampaignBean bean = model.toBean();
+ Campaign bean = model.toBean();
- CampaignBean saved;
- if (TuttiBeans.isNew(bean)) {
+ Campaign saved;
+ if (TuttiEntities.isNew(bean)) {
saved = persistenceService.createCampaign(bean);
} else {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,13 +24,14 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
-import fr.ifremer.tutti.persistence.entities.referential.GearBean;
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
-import fr.ifremer.tutti.persistence.entities.referential.UserBean;
-import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
+import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.Survey;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
+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.List;
@@ -41,48 +42,65 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1O
*/
-public class EditCampaignUIModel extends AbstractTuttiBeanUIModel {
+public class EditCampaignUIModel extends AbstractTuttiBeanUIModel<Campaign, EditCampaignUIModel> {
private static final long serialVersionUID = 1L;
- protected SurveyBean survey;
+ public static final String PROPERTY_SURVEY = "survey";
- protected CountryBean country;
+ 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";
+
+ protected Survey survey;
+
+ protected Country country;
+
protected String name;
protected String surveyPart;
- protected List<VesselBean> vessel;
+ protected List<Vessel> vessel;
- protected List<GearBean> gear;
+ protected List<Gear> gear;
- protected List<UserBean> headOfMission;
+ protected List<TuttiUser> headOfMission;
- protected List<UserBean> headOfSortRoom;
+ protected List<TuttiUser> headOfSortRoom;
protected String comment;
-// protected boolean create;
-//
-// public boolean isCreate() {
-// return create;
-// }
-//
-// public void setCreate(boolean create) {
-// Object oldValue = isCreate();
-// this.create = create;
-// firePropertyChange("create", oldValue, create);
-// }
+ protected static Binder<EditCampaignUIModel, Campaign> toBeanBinder =
+ BinderFactory.newBinder(EditCampaignUIModel.class,
+ Campaign.class);
- public SurveyBean getSurvey() {
+ protected static Binder<Campaign, EditCampaignUIModel> fromBeanBinder =
+ BinderFactory.newBinder(Campaign.class, EditCampaignUIModel.class);
+
+ public EditCampaignUIModel() {
+ super(Campaign.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public Survey getSurvey() {
return survey;
}
- public void setSurvey(SurveyBean survey) {
+ public void setSurvey(Survey survey) {
Object oldValue = getSurvey();
this.survey = survey;
- firePropertyChange("survey", oldValue, survey);
+ firePropertyChange(PROPERTY_SURVEY, oldValue, survey);
}
public String getName() {
@@ -92,7 +110,7 @@
public void setName(String name) {
Object oldValue = getName();
this.name = name;
- firePropertyChange("name", oldValue, name);
+ firePropertyChange(PROPERTY_NAME, oldValue, name);
}
public String getComment() {
@@ -102,17 +120,17 @@
public void setComment(String comment) {
Object oldValue = getComment();
this.comment = comment;
- firePropertyChange("comment", oldValue, comment);
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
}
- public CountryBean getCountry() {
+ public Country getCountry() {
return country;
}
- public void setCountry(CountryBean country) {
+ public void setCountry(Country country) {
Object oldValue = getCountry();
this.country = country;
- firePropertyChange("country", oldValue, country);
+ firePropertyChange(PROPERTY_COUNTRY, oldValue, country);
}
public String getSurveyPart() {
@@ -122,54 +140,43 @@
public void setSurveyPart(String surveyPart) {
Object oldValue = getSurveyPart();
this.surveyPart = surveyPart;
- firePropertyChange("surveyPart", oldValue, surveyPart);
+ firePropertyChange(PROPERTY_SURVEY_PART, oldValue, surveyPart);
}
- public List<VesselBean> getVessel() {
+ public List<Vessel> getVessel() {
return vessel;
}
- public void setVessel(List<VesselBean> vessel) {
+ public void setVessel(List<Vessel> vessel) {
this.vessel = vessel;
- firePropertyChange("vessel", null, vessel);
+ firePropertyChange(PROPERTY_VESSEL, null, vessel);
}
- public List<GearBean> getGear() {
+ public List<Gear> getGear() {
return gear;
}
- public void setGear(List<GearBean> gear) {
+ public void setGear(List<Gear> gear) {
this.gear = gear;
- firePropertyChange("gear", null, gear);
+ firePropertyChange(PROPERTY_GEAR, null, gear);
}
- public List<UserBean> getHeadOfMission() {
+ public List<TuttiUser> getHeadOfMission() {
return headOfMission;
}
- public void setHeadOfMission(List<UserBean> headOfMission) {
+ public void setHeadOfMission(List<TuttiUser> headOfMission) {
this.headOfMission = headOfMission;
- firePropertyChange("headOfMission", null, headOfMission);
+ firePropertyChange(PROPERTY_HEAD_OF_MISSION, null, headOfMission);
}
- public List<UserBean> getHeadOfSortRoom() {
+ public List<TuttiUser> getHeadOfSortRoom() {
return headOfSortRoom;
}
- public void setHeadOfSortRoom(List<UserBean> headOfSortRoom) {
+ public void setHeadOfSortRoom(List<TuttiUser> headOfSortRoom) {
this.headOfSortRoom = headOfSortRoom;
- firePropertyChange("headOfSortRoom", null, headOfSortRoom);
+ firePropertyChange(PROPERTY_HEAD_OF_SORT_ROOM, null, headOfSortRoom);
}
- public void fromBean(CampaignBean bean) {
- BinderFactory.newBinder(CampaignBean.class,
- EditCampaignUIModel.class).copy(bean, this);
- }
-
- public CampaignBean toBean() {
- CampaignBean result = new CampaignBean();
- BinderFactory.newBinder(EditCampaignUIModel.class,
- CampaignBean.class).copy(this, result);
- return result;
- }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,7 +25,7 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditSurveyUIModel, EditSurveyUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.referential.ZoneBean
+ fr.ifremer.tutti.persistence.entities.referential.Zone
fr.ifremer.tutti.ui.swing.TuttiUIContext
jaxx.runtime.swing.editor.bean.BeanComboBox
@@ -89,7 +89,7 @@
</cell>
<cell>
<BeanComboBox id='zoneComboBox' constructorParams='this'
- genericType='ZoneBean'/>
+ genericType='Zone'/>
</cell>
</row>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,8 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
-import fr.ifremer.tutti.persistence.entities.TuttiBeans;
+import fr.ifremer.tutti.persistence.entities.data.Survey;
+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;
@@ -73,7 +73,7 @@
log.info("Edit existing survey " + surveyId);
}
// load existing survey
- SurveyBean survey = persistenceService.getSurvey(surveyId);
+ Survey survey = persistenceService.getSurvey(surveyId);
model.fromBean(survey);
}
@@ -88,7 +88,7 @@
EditSurveyUIModel model = ui.getModel();
initBeanComboBox(ui.getZoneComboBox(),
- persistenceService.getAllZones(),
+ persistenceService.getAllZone(),
model.getZone());
SwingValidatorUtil.installUI(ui.getErrorTable(),
@@ -118,10 +118,10 @@
EditSurveyUIModel model = ui.getModel();
- SurveyBean bean = model.toBean();
+ Survey bean = model.toBean();
- SurveyBean saved;
- if (TuttiBeans.isNew(bean)) {
+ Survey saved;
+ if (TuttiEntities.isNew(bean)) {
saved = persistenceService.createSurvey(bean);
} else {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,9 +24,10 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
-import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
+import fr.ifremer.tutti.persistence.entities.data.Survey;
+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;
/**
@@ -35,28 +36,34 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class EditSurveyUIModel extends AbstractTuttiBeanUIModel {
+public class EditSurveyUIModel extends AbstractTuttiBeanUIModel<Survey, EditSurveyUIModel> {
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 ZoneBean zone;
+ protected Zone zone;
-// protected boolean create;
-//
-// public boolean isCreate() {
-// return create;
-// }
-//
-// public void setCreate(boolean create) {
-// Object oldValue = isCreate();
-// this.create = create;
-// firePropertyChange("create", oldValue, create);
-// }
+ protected static Binder<EditSurveyUIModel, Survey> toBeanBinder =
+ BinderFactory.newBinder(EditSurveyUIModel.class,
+ Survey.class);
+ protected static Binder<Survey, EditSurveyUIModel> fromBeanBinder =
+ BinderFactory.newBinder(Survey.class, EditSurveyUIModel.class);
+
+
+ public EditSurveyUIModel() {
+ super(Survey.class, fromBeanBinder, toBeanBinder);
+ }
+
public String getName() {
return name;
}
@@ -64,7 +71,7 @@
public void setName(String name) {
Object oldValue = getName();
this.name = name;
- firePropertyChange("name", oldValue, name);
+ firePropertyChange(PROPERTY_NAME, oldValue, name);
}
public String getComment() {
@@ -74,28 +81,17 @@
public void setComment(String comment) {
Object oldValue = getComment();
this.comment = comment;
- firePropertyChange("comment", oldValue, comment);
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
}
- public ZoneBean getZone() {
+ public Zone getZone() {
return zone;
}
- public void setZone(ZoneBean zone) {
+ public void setZone(Zone zone) {
Object oldValue = getZone();
this.zone = zone;
- firePropertyChange("zone", oldValue, zone);
+ firePropertyChange(PROPERTY_ZONE, oldValue, zone);
}
- public void fromBean(SurveyBean bean) {
- BinderFactory.newBinder(SurveyBean.class,
- EditSurveyUIModel.class).copy(bean, this);
- }
-
- public SurveyBean toBean() {
- SurveyBean result = new SurveyBean();
- BinderFactory.newBinder(EditSurveyUIModel.class,
- SurveyBean.class).copy(this, result);
- return result;
- }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,9 +25,9 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<SelectCampaignUIModel, SelectCampaignUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.SurveyBean
- fr.ifremer.tutti.persistence.entities.CampaignBean
- fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.data.Survey
+ fr.ifremer.tutti.persistence.entities.data.Campaign
+ fr.ifremer.tutti.persistence.entities.data.Trait
fr.ifremer.tutti.ui.swing.TuttiUIContext
jaxx.runtime.swing.editor.bean.BeanComboBox
@@ -64,7 +64,7 @@
</cell>
<cell weightx='1.0'>
<BeanComboBox id='surveyCombobox' constructorParams='this'
- genericType='SurveyBean'/>
+ genericType='Survey'/>
</cell>
<cell>
<JPanel layout='{new GridLayout(1,0)}'>
@@ -81,7 +81,7 @@
</cell>
<cell>
<BeanComboBox id='campaignCombobox' constructorParams='this'
- genericType='CampaignBean'/>
+ genericType='Campaign'/>
</cell>
<cell>
<JPanel layout='{new GridLayout(1,0)}'>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,9 +25,9 @@
*/
import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
-import fr.ifremer.tutti.persistence.entities.TuttiBeans;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.Survey;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.TuttiScreen;
@@ -72,7 +72,7 @@
public void beforeInitUI() {
SelectCampaignUIModel model = new SelectCampaignUIModel();
- List<SurveyBean> allSurveys = persistenceService.getAllSurveys();
+ List<Survey> allSurveys = persistenceService.getAllSurvey();
model.setSurveys(allSurveys);
@@ -84,11 +84,11 @@
// get selected survey (if any)
String surveyId = context.getSurveyId();
- SurveyBean selectedSurvey = null;
- List<CampaignBean> allCampaigns = null;
+ Survey selectedSurvey = null;
+ List<Campaign> allCampaigns = null;
if (surveyId != null) {
- selectedSurvey = TuttiBeans.findById(allSurveys, surveyId);
- allCampaigns = persistenceService.getAllCampaigns(surveyId);
+ selectedSurvey = TuttiEntities.findById(allSurveys, surveyId);
+ allCampaigns = persistenceService.getAllCampaign(surveyId);
}
model.setSurvey(selectedSurvey);
@@ -100,10 +100,10 @@
} else {
String campaignId = context.getCampaignId();
- CampaignBean selectedCampaign = null;
+ Campaign selectedCampaign = null;
if (campaignId != null) {
selectedCampaign =
- TuttiBeans.findById(allCampaigns, campaignId);
+ TuttiEntities.findById(allCampaigns, campaignId);
}
model.setCampaign(selectedCampaign);
}
@@ -127,14 +127,14 @@
model.addPropertyChangeListener("survey", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- SurveyBean newValue = (SurveyBean) evt.getNewValue();
+ Survey newValue = (Survey) evt.getNewValue();
boolean noSurvey = newValue == null;
context.setSurveyId(noSurvey ? null : newValue.getId());
- List<CampaignBean> campaigns;
+ List<Campaign> campaigns;
if (noSurvey) {
campaigns = Lists.newArrayList();
} else {
- campaigns = persistenceService.getAllCampaigns(newValue.getId());
+ campaigns = persistenceService.getAllCampaign(newValue.getId());
}
SelectCampaignUIModel model = (SelectCampaignUIModel) evt.getSource();
model.setCampaigns(campaigns);
@@ -146,8 +146,8 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
// reload combo box
- BeanComboBox<CampaignBean> combobox = ui.getCampaignCombobox();
- List<CampaignBean> campaigns = (List<CampaignBean>) evt.getNewValue();
+ BeanComboBox<Campaign> combobox = ui.getCampaignCombobox();
+ List<Campaign> campaigns = (List<Campaign>) evt.getNewValue();
combobox.setData(null);
combobox.setData(campaigns);
}
@@ -156,7 +156,7 @@
model.addPropertyChangeListener("campaign", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- CampaignBean newValue = (CampaignBean) evt.getNewValue();
+ Campaign newValue = (Campaign) evt.getNewValue();
context.setCampaignId(newValue == null ? null : newValue.getId());
}
});
@@ -177,7 +177,7 @@
public void showSelectedSurvey() {
- SurveyBean survey = getModel().getSurvey();
+ Survey survey = getModel().getSurvey();
context.setSurveyId(survey.getId());
context.setScreen(TuttiScreen.EDIT_SURVEY);
}
@@ -189,7 +189,7 @@
}
public void showSelectedCampaign() {
- CampaignBean campaign = getModel().getCampaign();
+ Campaign campaign = getModel().getCampaign();
context.setCampaignId(campaign.getId());
context.setScreen(TuttiScreen.EDIT_CAMPAIGN);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,8 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
+import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.Survey;
import org.jdesktop.beans.AbstractSerializableBean;
import java.util.List;
@@ -52,19 +52,19 @@
public static final String PROPERTY_CAMPAIGN_FOUND = "campaignFound";
- protected List<SurveyBean> surveys;
+ protected List<Survey> surveys;
- protected SurveyBean survey;
+ protected Survey survey;
- protected List<CampaignBean> campaigns;
+ protected List<Campaign> campaigns;
- protected CampaignBean campaign;
+ protected Campaign campaign;
- public List<SurveyBean> getSurveys() {
+ public List<Survey> getSurveys() {
return surveys;
}
- public void setSurveys(List<SurveyBean> surveys) {
+ public void setSurveys(List<Survey> surveys) {
Object oldValue = getSurveys();
this.surveys = surveys;
@@ -73,12 +73,12 @@
firePropertyChange(PROPERTY_SURVEYS, oldValue, surveys);
}
- public SurveyBean getSurvey() {
+ public Survey getSurvey() {
return survey;
}
- public void setSurvey(SurveyBean survey) {
- SurveyBean oldValue = getSurvey();
+ public void setSurvey(Survey survey) {
+ Survey oldValue = getSurvey();
this.survey = survey;
// nullify campaigns
@@ -92,11 +92,11 @@
return survey != null;
}
- public List<CampaignBean> getCampaigns() {
+ public List<Campaign> getCampaigns() {
return campaigns;
}
- public void setCampaigns(List<CampaignBean> campaigns) {
+ public void setCampaigns(List<Campaign> campaigns) {
Object oldValue = getCampaigns();
this.campaigns = campaigns;
@@ -105,12 +105,12 @@
firePropertyChange(PROPERTY_CAMPAIGNS, oldValue, campaigns);
}
- public CampaignBean getCampaign() {
+ public Campaign getCampaign() {
return campaign;
}
- public void setCampaign(CampaignBean campaign) {
- CampaignBean oldValue = getCampaign();
+ public void setCampaign(Campaign campaign) {
+ Campaign oldValue = getCampaign();
this.campaign = campaign;
firePropertyChange(PROPERTY_CAMPAIGN, oldValue, campaign);
firePropertyChange(PROPERTY_CAMPAIGN_FOUND, oldValue != null, campaign != null);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,7 +25,7 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<CatchesUIModel, CatchesUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.data.Trait
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.catches.accidentel.AccidentelTabUI
@@ -63,7 +63,7 @@
<row>
<cell anchor='west' weightx='1.0'>
<BeanComboBox id='traitComboBox' constructorParams='this'
- genericType='TraitBean'/>
+ genericType='Trait'/>
</cell>
<cell anchor='east'>
<JButton id='newTraitButton'
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,9 +24,9 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TuttiBeans;
+import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
+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.TuttiUIContext;
@@ -67,10 +67,10 @@
String campaignId = context.getCampaignId();
// load existing campaign
- CampaignBean campaign = persistenceService.getCampaign(campaignId);
+ Campaign campaign = persistenceService.getCampaign(campaignId);
model.setCampaign(campaign);
- List<TraitBean> traits = persistenceService.getAllTraits(campaignId);
+ List<Trait> traits = persistenceService.getAllTrait(campaignId);
model.setTrait(traits);
if (log.isInfoEnabled()) {
@@ -87,7 +87,7 @@
initUI(ui);
- List<TraitBean> traits = model.getTrait();
+ List<Trait> traits = model.getTrait();
initBeanComboBox(ui.getTraitComboBox(),
traits,
@@ -96,7 +96,7 @@
model.addPropertyChangeListener(CatchesUIModel.PROPERTY_SELECTED_TRAIT, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- selectTrait((TraitBean) evt.getNewValue());
+ selectTrait((Trait) evt.getNewValue());
}
});
@@ -104,7 +104,7 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
ui.getTraitComboBox().setData(null);
- ui.getTraitComboBox().setData((List<TraitBean>) evt.getNewValue());
+ ui.getTraitComboBox().setData((List<Trait>) evt.getNewValue());
}
});
@@ -136,13 +136,13 @@
ui.getModel().setSelectedTrait(null);
// use a new empty trait
- TraitBean newTrait = new TraitBean();
+ Trait newTrait = new Trait();
newTrait.setCampaign(ui.getModel().getCampaign());
newTrait.setDate(new Date());
selectTrait(newTrait);
}
- public void selectTrait(TraitBean selectedTrait) {
+ public void selectTrait(Trait selectedTrait) {
if (log.isInfoEnabled()) {
log.info("New selected trait: " + selectedTrait);
@@ -166,13 +166,13 @@
// ui.getObservationIndividuelTabContent().selectTrait(selectedTrait);
}
- public void saveTrait(TraitBean toSave) {
+ public void saveTrait(Trait toSave) {
// persist the trait
boolean create = toSave.getId() == null;
- TraitBean savedTrait;
+ Trait savedTrait;
if (create) {
savedTrait = persistenceService.createTrait(toSave);
} else {
@@ -183,9 +183,9 @@
// add the saved trait to trait list
- List<TraitBean> data = model.getTrait();
+ List<Trait> data = model.getTrait();
- TraitBean existingTrait = TuttiBeans.findById(data, savedTrait.getId());
+ Trait existingTrait = TuttiEntities.findById(data, savedTrait.getId());
if (existingTrait != null) {
data.remove(existingTrait);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,8 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
import org.jdesktop.beans.AbstractSerializableBean;
import java.util.List;
@@ -46,36 +46,36 @@
public static final String PROPERTY_CAMPAIGN = "campaign";
- protected List<TraitBean> trait;
+ protected List<Trait> trait;
- protected TraitBean selectedTrait;
+ protected Trait selectedTrait;
- protected CampaignBean campaign;
+ protected Campaign campaign;
- public List<TraitBean> getTrait() {
+ public List<Trait> getTrait() {
return trait;
}
- public void setTrait(List<TraitBean> trait) {
+ public void setTrait(List<Trait> trait) {
this.trait = trait;
firePropertyChange(PROPERTY_TRAIT, null, trait);
}
- public TraitBean getSelectedTrait() {
+ public Trait getSelectedTrait() {
return selectedTrait;
}
- public void setSelectedTrait(TraitBean selectedTrait) {
+ public void setSelectedTrait(Trait selectedTrait) {
Object oldValue = getSelectedTrait();
this.selectedTrait = selectedTrait;
firePropertyChange(PROPERTY_SELECTED_TRAIT, oldValue, selectedTrait);
}
- public CampaignBean getCampaign() {
+ public Campaign getCampaign() {
return campaign;
}
- public void setCampaign(CampaignBean campaign) {
+ public void setCampaign(Campaign campaign) {
Object oldValue = getCampaign();
this.campaign = campaign;
firePropertyChange(PROPERTY_CAMPAIGN, oldValue, campaign);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css 2012-12-06 17:03:05 UTC (rev 30)
@@ -250,7 +250,7 @@
#saisisseurHeader {
labelText:{_("tutti.label.list.saisisseur")};
list:{saisisseurList};
- beanType:{UserBean.class};
+ beanType:{TuttiUser.class};
}
#commentPane {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,11 +25,11 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<TraitTabUIModel, TraitTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
- fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
+ fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
+ fr.ifremer.tutti.persistence.entities.referential.SeaState
+ fr.ifremer.tutti.persistence.entities.data.Strata
+ fr.ifremer.tutti.persistence.entities.data.Trait
+ fr.ifremer.tutti.persistence.entities.referential.TuttiUser
fr.ifremer.tutti.ui.swing.TuttiUIContext
jaxx.runtime.swing.editor.bean.BeanComboBox
@@ -58,7 +58,7 @@
handler.beforeInitUI();
}
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+public void selectTrait(Trait trait) { handler.selectTrait(trait); }
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
@@ -129,7 +129,7 @@
</cell>
<cell fill='horizontal'>
<BeanComboBox id='strataComboBox' constructorParams='this'
- genericType='StrataBean'/>
+ genericType='Strata'/>
</cell>
</row>
@@ -140,7 +140,7 @@
</cell>
<cell fill='horizontal'>
<BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
- genericType='BeaufortScaleBean'/>
+ genericType='BeaufortScale'/>
</cell>
</row>
@@ -161,7 +161,7 @@
</cell>
<cell fill='horizontal'>
<BeanComboBox id='seaStateComboBox' constructorParams='this'
- genericType='SeaStateBean'/>
+ genericType='SeaState'/>
</cell>
</row>
@@ -294,9 +294,9 @@
<JScrollPane id='saisisseurPane'
columnHeaderView="{saisisseurHeader}"
onFocusGained='saisisseurList.requestFocus()'>
- <JList id='saisisseurList' genericType='UserBean'
+ <JList id='saisisseurList'
onValueChanged='handler.selectListData(event, "saisisseur")'/>
- <BeanListHeader id='saisisseurHeader' genericType='UserBean'/>
+ <BeanListHeader id='saisisseurHeader' genericType='TuttiUser'/>
</JScrollPane>
</cell>
</row>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,8 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.referential.UserBean;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import org.apache.commons.collections.CollectionUtils;
@@ -101,19 +101,19 @@
initUI(ui);
initBeanList(ui.getSaisisseurHeader(),
- persistenceService.getAllUsers(),
+ persistenceService.getAllTuttiUser(),
model.getSaisisseur());
initBeanComboBox(ui.getBeaufortScaleComboBox(),
- persistenceService.getAllBeaufortScales(),
+ persistenceService.getAllBeaufortScale(),
model.getBeaufortScale());
initBeanComboBox(ui.getStrataComboBox(),
- persistenceService.getAllStratas(),
+ persistenceService.getAllStrata(),
model.getStrata());
initBeanComboBox(ui.getSeaStateComboBox(),
- persistenceService.getAllSeaStates(),
+ persistenceService.getAllSeaState(),
model.getSeaState());
model.setEmpty(true);
@@ -130,7 +130,7 @@
return ui.getModel();
}
- public void selectTrait(TraitBean bean) {
+ public void selectTrait(Trait bean) {
boolean empty = bean == null;
@@ -141,14 +141,14 @@
if (empty) {
- model.fromBean(new TraitBean());
+ model.fromBean(new Trait());
} else {
model.fromBean(bean);
}
// update saisissuer selection
- List<UserBean> saisisseur = model.getSaisisseur();
+ List<TuttiUser> saisisseur = model.getSaisisseur();
if (CollectionUtils.isNotEmpty(saisisseur)) {
updateIndices(ui.getSaisisseurList(), saisisseur);
}
@@ -180,7 +180,7 @@
} else {
// reselect in ui the trait
- TraitBean selectedTrait = parentUi.getModel().getSelectedTrait();
+ Trait selectedTrait = parentUi.getModel().getSelectedTrait();
parentUi.getHandler().selectTrait(selectedTrait);
}
}
@@ -188,7 +188,7 @@
public void save() {
// get trait to save
- TraitBean toSave = ui.getModel().toBean();
+ Trait toSave = ui.getModel().toBean();
if (log.isInfoEnabled()) {
log.info("Save edition for trait: " + toSave.getId());
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,13 +24,14 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.StrataBean;
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
-import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
-import fr.ifremer.tutti.persistence.entities.referential.UserBean;
+import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.Strata;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.SeaState;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
import java.util.Date;
@@ -42,7 +43,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class TraitTabUIModel extends AbstractTuttiBeanUIModel {
+public class TraitTabUIModel extends AbstractTuttiBeanUIModel<Trait, TraitTabUIModel> {
private static final long serialVersionUID = 1L;
@@ -126,7 +127,7 @@
protected boolean empty;
- protected CampaignBean campaign;
+ protected Campaign campaign;
protected Integer stationNumber;
@@ -134,7 +135,7 @@
protected Date date;
- protected StrataBean strata;
+ protected Strata strata;
protected Float gearShootingStartLatitude;
@@ -152,11 +153,11 @@
protected Float gearShootingEndDepth;
- protected BeaufortScaleBean beaufortScale;
+ protected BeaufortScale beaufortScale;
protected Integer windDirection;
- protected SeaStateBean seaState;
+ protected SeaState seaState;
protected Float ouvertureHorizontale;
@@ -182,7 +183,7 @@
protected String comment;
- protected List<UserBean> saisisseur;
+ protected List<TuttiUser> saisisseur;
protected Float gearShootingStartSurfaceTemperature;
@@ -204,6 +205,17 @@
protected Float averageBottomSalinity;
+ protected static Binder<TraitTabUIModel, Trait> toBeanBinder =
+ BinderFactory.newBinder(TraitTabUIModel.class,
+ Trait.class);
+
+ protected static Binder<Trait, TraitTabUIModel> fromBeanBinder =
+ BinderFactory.newBinder(Trait.class, TraitTabUIModel.class);
+
+ public TraitTabUIModel() {
+ super(Trait.class, fromBeanBinder, toBeanBinder);
+ }
+
public boolean isEmpty() {
return empty;
}
@@ -214,11 +226,11 @@
firePropertyChange(PROPERTY_EMPTY, oldValue, empty);
}
- public CampaignBean getCampaign() {
+ public Campaign getCampaign() {
return campaign;
}
- public void setCampaign(CampaignBean campaign) {
+ public void setCampaign(Campaign campaign) {
this.campaign = campaign;
}
@@ -252,11 +264,11 @@
firePropertyChange(PROPERTY_DATE, oldValue, date);
}
- public StrataBean getStrata() {
+ public Strata getStrata() {
return strata;
}
- public void setStrata(StrataBean strata) {
+ public void setStrata(Strata strata) {
Object oldValue = getStrata();
this.strata = strata;
firePropertyChange(PROPERTY_STRATA, oldValue, strata);
@@ -342,11 +354,11 @@
firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth);
}
- public BeaufortScaleBean getBeaufortScale() {
+ public BeaufortScale getBeaufortScale() {
return beaufortScale;
}
- public void setBeaufortScale(BeaufortScaleBean beaufortScale) {
+ public void setBeaufortScale(BeaufortScale beaufortScale) {
Object oldValue = getBeaufortScale();
this.beaufortScale = beaufortScale;
firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale);
@@ -362,11 +374,11 @@
firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection);
}
- public SeaStateBean getSeaState() {
+ public SeaState getSeaState() {
return seaState;
}
- public void setSeaState(SeaStateBean seaState) {
+ public void setSeaState(SeaState seaState) {
Object oldValue = getSeaState();
this.seaState = seaState;
firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState);
@@ -492,11 +504,11 @@
firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
}
- public List<UserBean> getSaisisseur() {
+ public List<TuttiUser> getSaisisseur() {
return saisisseur;
}
- public void setSaisisseur(List<UserBean> saisisseur) {
+ public void setSaisisseur(List<TuttiUser> saisisseur) {
this.saisisseur = saisisseur;
firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur);
}
@@ -600,16 +612,4 @@
this.averageBottomSalinity = averageBottomSalinity;
firePropertyChange(PROPERTY_AVERAGE_BOTTOM_SALINITY, oldValue, averageBottomSalinity);
}
-
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- TraitTabUIModel.class).copy(bean, this);
- }
-
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(TraitTabUIModel.class,
- TraitBean.class).copy(this, result);
- return result;
- }
}
\ No newline at end of file
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-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,7 +25,7 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<AccidentelTabUIModel, AccidentelTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.data.Trait
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
@@ -49,7 +49,7 @@
handler.beforeInitUI();
}
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+public void selectTrait(Trait trait) { handler.selectTrait(trait); }
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
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-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,10 +24,10 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
+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.CatchesUI;
@@ -91,10 +91,10 @@
col = new TableColumn(0);
JComboBox speciesEditor = new JComboBox();
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ List<Species> allSpecies = persistenceService.getAllSpecies();
SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
// col.setCellEditor();
- col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+// col.setCellRenderer(newTableCellRender(Species.class));
col.setHeaderValue(_("tutti.table.captureAccidentel.header.speciesByCode"));
// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
col.setIdentifier("speciesByCode");
@@ -126,7 +126,7 @@
model.addPropertyChangeListener(AccidentelTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ tableModel.setData((List<SpeciesBatch>) evt.getNewValue());
}
});
@@ -148,19 +148,19 @@
return ui.getModel();
}
- public void selectTrait(TraitBean bean) {
+ public void selectTrait(Trait bean) {
boolean empty = bean == null;
AccidentelTabUIModel model = ui.getModel();
- List<TraitCaptureAccidentelCatchBean> catches;
+ List<AccidentelBatch> catches;
if (empty) {
catches = null;
- bean = new TraitBean();
+ bean = new Trait();
} else {
- catches = persistenceService.getAllTraitCaptureAccidentelCatch(bean.getId());
+ catches = persistenceService.getAllAccidentelBatch(bean.getId());
}
model.fromBean(bean);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,8 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
+import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
import org.jdesktop.beans.AbstractSerializableBean;
import org.nuiton.util.beans.BinderFactory;
@@ -49,7 +49,7 @@
protected Float sampleTotalWeight;
- protected List<TraitCaptureAccidentelCatchBean> catches;
+ protected List<AccidentelBatch> catches;
public Float getTotalWeight() {
return totalWeight;
@@ -71,25 +71,25 @@
firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
}
- public List<TraitCaptureAccidentelCatchBean> getCatches() {
+ public List<AccidentelBatch> getCatches() {
return catches;
}
- public void setCatches(List<TraitCaptureAccidentelCatchBean> catches) {
+ public void setCatches(List<AccidentelBatch> catches) {
Object oldValue = getCatches();
this.catches = catches;
firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
}
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
+ public void fromBean(Trait bean) {
+ BinderFactory.newBinder(Trait.class,
AccidentelTabUIModel.class).copy(bean, this);
}
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
+ public Trait toBean() {
+ Trait result = new Trait();
BinderFactory.newBinder(AccidentelTabUIModel.class,
- TraitBean.class).copy(this, result);
+ Trait.class).copy(this, result);
return result;
}
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,7 +25,7 @@
*/
import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumnModel;
@@ -39,7 +39,7 @@
private static final long serialVersionUID = 1L;
- protected List<TraitSpeciesCatchBean> data;
+ protected List<SpeciesBatch> data;
protected final TableColumnModel columnModel;
@@ -47,10 +47,10 @@
this.columnModel = columnModel;
}
- public void setData(List<TraitSpeciesCatchBean> data) {
+ public void setData(List<SpeciesBatch> data) {
if (data == null) {
data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
+ data.add(new SpeciesBatch());
}
this.data = data;
fireTableDataChanged();
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-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,7 +25,7 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<BenthosTabUIModel, BenthosTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.data.Trait
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
@@ -49,7 +49,7 @@
handler.beforeInitUI();
}
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+public void selectTrait(Trait trait) { handler.selectTrait(trait); }
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
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-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,10 +24,10 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
+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.CatchesUI;
@@ -91,10 +91,10 @@
col = new TableColumn(0);
JComboBox speciesEditor = new JComboBox();
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ List<Species> allSpecies = persistenceService.getAllSpecies();
SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
// col.setCellEditor();
- col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+// col.setCellRenderer(newTableCellRender(Species.class));
col.setHeaderValue(_("tutti.table.benthos.header.speciesByCode"));
// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
col.setIdentifier("speciesByCode");
@@ -126,7 +126,7 @@
model.addPropertyChangeListener(BenthosTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ tableModel.setData((List<SpeciesBatch>) evt.getNewValue());
}
});
@@ -148,19 +148,19 @@
return ui.getModel();
}
- public void selectTrait(TraitBean bean) {
+ public void selectTrait(Trait bean) {
boolean empty = bean == null;
BenthosTabUIModel model = ui.getModel();
- List<TraitBenthosCatchBean> catches;
+ List<BenthosBatch> catches;
if (empty) {
catches = null;
- bean = new TraitBean();
+ bean = new Trait();
} else {
- catches = persistenceService.getAllTraitBenthosCatch(bean.getId());
+ catches = persistenceService.getAllBenthosBatch(bean.getId());
}
model.fromBean(bean);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,8 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
import org.jdesktop.beans.AbstractSerializableBean;
import org.nuiton.util.beans.BinderFactory;
@@ -49,7 +49,7 @@
protected Float sampleTotalWeight;
- protected List<TraitBenthosCatchBean> catches;
+ protected List<BenthosBatch> catches;
public Float getTotalWeight() {
return totalWeight;
@@ -71,25 +71,25 @@
firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
}
- public List<TraitBenthosCatchBean> getCatches() {
+ public List<BenthosBatch> getCatches() {
return catches;
}
- public void setCatches(List<TraitBenthosCatchBean> catches) {
+ public void setCatches(List<BenthosBatch> catches) {
Object oldValue = getCatches();
this.catches = catches;
firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
}
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
+ public void fromBean(Trait bean) {
+ BinderFactory.newBinder(Trait.class,
BenthosTabUIModel.class).copy(bean, this);
}
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
+ public Trait toBean() {
+ Trait result = new Trait();
BinderFactory.newBinder(BenthosTabUIModel.class,
- TraitBean.class).copy(this, result);
+ Trait.class).copy(this, result);
return result;
}
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,7 +25,7 @@
*/
import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumnModel;
@@ -39,7 +39,7 @@
private static final long serialVersionUID = 1L;
- protected List<TraitSpeciesCatchBean> data;
+ protected List<SpeciesBatch> data;
protected final TableColumnModel columnModel;
@@ -47,10 +47,10 @@
this.columnModel = columnModel;
}
- public void setData(List<TraitSpeciesCatchBean> data) {
+ public void setData(List<SpeciesBatch> data) {
if (data == null) {
data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
+ data.add(new SpeciesBatch());
}
this.data = data;
fireTableDataChanged();
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-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,7 +25,7 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<MacroDechetTabUIModel, MacroDechetTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.data.Trait
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
@@ -49,7 +49,7 @@
handler.beforeInitUI();
}
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+public void selectTrait(Trait trait) { handler.selectTrait(trait); }
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
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-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,10 +24,10 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
+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.catches.CatchesUI;
@@ -91,10 +91,10 @@
col = new TableColumn(0);
JComboBox speciesEditor = new JComboBox();
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ List<Species> allSpecies = persistenceService.getAllSpecies();
SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
// col.setCellEditor();
- col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+// col.setCellRenderer(newTableCellRender(Species.class));
col.setHeaderValue(_("tutti.table.macroDechet.header.speciesByCode"));
// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
col.setIdentifier("speciesByCode");
@@ -126,7 +126,7 @@
model.addPropertyChangeListener(MacroDechetTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ tableModel.setData((List<SpeciesBatch>) evt.getNewValue());
}
});
@@ -148,19 +148,19 @@
return ui.getModel();
}
- public void selectTrait(TraitBean bean) {
+ public void selectTrait(Trait bean) {
boolean empty = bean == null;
MacroDechetTabUIModel model = ui.getModel();
- List<TraitMacroDechetCatchBean> catches;
+ List<MacroDechetBatch> catches;
if (empty) {
catches = null;
- bean = new TraitBean();
+ bean = new Trait();
} else {
- catches = persistenceService.getAllTraitMacroDechetCatch(bean.getId());
+ catches = persistenceService.getAllMacroDechetBatch(bean.getId());
}
model.fromBean(bean);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,8 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
+import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
import org.jdesktop.beans.AbstractSerializableBean;
import org.nuiton.util.beans.BinderFactory;
@@ -49,7 +49,7 @@
protected Float sampleTotalWeight;
- protected List<TraitMacroDechetCatchBean> catches;
+ protected List<MacroDechetBatch> catches;
public Float getTotalWeight() {
return totalWeight;
@@ -71,25 +71,25 @@
firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
}
- public List<TraitMacroDechetCatchBean> getCatches() {
+ public List<MacroDechetBatch> getCatches() {
return catches;
}
- public void setCatches(List<TraitMacroDechetCatchBean> catches) {
+ public void setCatches(List<MacroDechetBatch> catches) {
Object oldValue = getCatches();
this.catches = catches;
firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
}
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
+ public void fromBean(Trait bean) {
+ BinderFactory.newBinder(Trait.class,
MacroDechetTabUIModel.class).copy(bean, this);
}
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
+ public Trait toBean() {
+ Trait result = new Trait();
BinderFactory.newBinder(MacroDechetTabUIModel.class,
- TraitBean.class).copy(this, result);
+ Trait.class).copy(this, result);
return result;
}
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,7 +25,7 @@
*/
import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumnModel;
@@ -39,7 +39,7 @@
private static final long serialVersionUID = 1L;
- protected List<TraitSpeciesCatchBean> data;
+ protected List<SpeciesBatch> data;
protected final TableColumnModel columnModel;
@@ -47,10 +47,10 @@
this.columnModel = columnModel;
}
- public void setData(List<TraitSpeciesCatchBean> data) {
+ public void setData(List<SpeciesBatch> data) {
if (data == null) {
data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
+ data.add(new SpeciesBatch());
}
this.data = data;
fireTableDataChanged();
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-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,7 +25,7 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<PlanctonTabUIModel, PlanctonTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.data.Trait
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
@@ -49,7 +49,7 @@
handler.beforeInitUI();
}
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+public void selectTrait(Trait trait) { handler.selectTrait(trait); }
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
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-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,10 +24,10 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
+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.catches.CatchesUI;
@@ -91,10 +91,10 @@
col = new TableColumn(0);
JComboBox speciesEditor = new JComboBox();
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ List<Species> allSpecies = persistenceService.getAllSpecies();
SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
// col.setCellEditor();
- col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+// col.setCellRenderer(newTableCellRender(Species.class));
col.setHeaderValue(_("tutti.table.plancton.header.speciesByCode"));
// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
col.setIdentifier("speciesByCode");
@@ -126,7 +126,7 @@
model.addPropertyChangeListener(PlanctonTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ tableModel.setData((List<SpeciesBatch>) evt.getNewValue());
}
});
@@ -148,19 +148,19 @@
return ui.getModel();
}
- public void selectTrait(TraitBean bean) {
+ public void selectTrait(Trait bean) {
boolean empty = bean == null;
PlanctonTabUIModel model = ui.getModel();
- List<TraitPlanctonCatchBean> catches;
+ List<PlanctonBatch> catches;
if (empty) {
catches = null;
- bean = new TraitBean();
+ bean = new Trait();
} else {
- catches = persistenceService.getAllTraitPlanctonCatch(bean.getId());
+ catches = persistenceService.getAllPlanctonBatch(bean.getId());
}
model.fromBean(bean);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,8 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
+import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
import org.jdesktop.beans.AbstractSerializableBean;
import org.nuiton.util.beans.BinderFactory;
@@ -49,7 +49,7 @@
protected Float sampleTotalWeight;
- protected List<TraitPlanctonCatchBean> catches;
+ protected List<PlanctonBatch> catches;
public Float getTotalWeight() {
return totalWeight;
@@ -71,25 +71,25 @@
firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
}
- public List<TraitPlanctonCatchBean> getCatches() {
+ public List<PlanctonBatch> getCatches() {
return catches;
}
- public void setCatches(List<TraitPlanctonCatchBean> catches) {
+ public void setCatches(List<PlanctonBatch> catches) {
Object oldValue = getCatches();
this.catches = catches;
firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
}
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
+ public void fromBean(Trait bean) {
+ BinderFactory.newBinder(Trait.class,
PlanctonTabUIModel.class).copy(bean, this);
}
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
+ public Trait toBean() {
+ Trait result = new Trait();
BinderFactory.newBinder(PlanctonTabUIModel.class,
- TraitBean.class).copy(this, result);
+ Trait.class).copy(this, result);
return result;
}
}
\ No newline at end of file
Modified: 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/catches/plancton/PlanctonTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,7 +25,7 @@
*/
import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumnModel;
@@ -39,7 +39,7 @@
private static final long serialVersionUID = 1L;
- protected List<TraitSpeciesCatchBean> data;
+ protected List<SpeciesBatch> data;
protected final TableColumnModel columnModel;
@@ -47,10 +47,10 @@
this.columnModel = columnModel;
}
- public void setData(List<TraitSpeciesCatchBean> data) {
+ public void setData(List<SpeciesBatch> data) {
if (data == null) {
data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
+ data.add(new SpeciesBatch());
}
this.data = data;
fireTableDataChanged();
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,99 +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 org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.AbstractAction;
-import javax.swing.JTable;
-
-/**
- * Abstract action to select something in a table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public abstract class AbstractSelectTableAction extends AbstractAction {
-
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(AbstractSelectTableAction.class);
-
- private final JTable table;
-
- private final SpeciesTabUIModel model;
-
- public AbstractSelectTableAction(SpeciesTabUIModel model,
- JTable table) {
- this.model = model;
- this.table = table;
- }
-
- protected void doSelectCell(int rowIndex, int columnIndex) {
-
- if (log.isDebugEnabled()) {
- log.debug("Will select cell at " +
- getCellCoordinate(rowIndex, columnIndex));
- }
-
- table.editCellAt(rowIndex, columnIndex);
- table.setColumnSelectionInterval(columnIndex, columnIndex);
- table.setRowSelectionInterval(rowIndex, rowIndex);
- }
-
-
- protected int getSelectedRow() {
- int result = table.getSelectedRow();
- return result;
- }
-
- protected int getSelectedColumn() {
- int result = table.getSelectedColumn();
- return result;
- }
-
- protected int getRowCount() {
- return table.getRowCount();
- }
-
- protected int getColumnCount() {
- return table.getColumnCount();
- }
-
- protected boolean isCellEditable(int rowIndex, int columnIndex) {
- return table.isCellEditable(rowIndex, columnIndex);
- }
-
- protected String getCellCoordinate(int rowIndex, int columnIndex) {
- return " [" + rowIndex + ", " + columnIndex + "]";
- }
-
- protected SpeciesTabUIModel getModel() {
- return model;
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,104 +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.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class CatchTreeModel implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Root node (with no sampling on it.
- *
- * @since 0.2
- */
- protected final CatchTreeNode root;
-
- /**
- * Property which are used to sub sampling.
- *
- * @since 0.2
- */
- protected final String[] samplingOrder;
-
- /**
- * Samplings view as a linear list (to display in the table).
- *
- * @since 0.2
- */
- protected final List<CatchTreeNode> lines;
-
- public CatchTreeModel(String... samplingOrder) {
- this.samplingOrder = samplingOrder;
- root = new CatchTreeNode();
- lines = Lists.newArrayList();
- }
-
- public CatchTreeNode getNode(int rowIndex) {
- return lines.get(rowIndex);
- }
-
- public int getSize() {
- return lines.size();
- }
-
- public void populate(List<TraitSpeciesCatchBean> data) {
-
- // clear tree representation
- root.removeAllChildren();
-
- // clear linear representation
- lines.clear();
- }
-
- public Object[] getSamplingKey(TraitSpeciesCatchBean bean) {
- List<Object> result = Lists.newArrayList();
- for (String s : samplingOrder) {
- Object property = TuttiUIUtil.getProperty(bean, s);
- if (property == null) {
- // stop findind sample key
- break;
- }
- result.add(property);
- }
- return result.toArray();
- }
-
- public String[] getSamplingDefinition(TraitSpeciesCatchBean bean) {
- return null;
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -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.TraitSpeciesCatchBean;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreeNode;
-import java.io.Serializable;
-
-/**
- * Defines a node of a species catches.
- * <p/>
- * UserObject is the {@link TraitSpeciesCatchBean}. It can be null on two cases:
- * <ul>
- * <li>On root node</li>
- * <li>For node on a path of sampling but with no filled data </li>
- * </ul>
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class CatchTreeNode extends DefaultMutableTreeNode {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Property name defining the sampling.
- * <p/>
- * <strong>Note:</strong> can be null (only for root node).
- *
- * @since 0.2
- */
- protected final String samplingPropertyKey;
-
- /**
- * Property value defining the sampling.
- * <p/>
- * <strong>Note:</strong> can be null (only for root node).
- *
- * @since 0.2
- */
- protected final Serializable samplingPropertyValue;
-
- public CatchTreeNode() {
- this(null, null, null);
- }
-
- public CatchTreeNode(TraitSpeciesCatchBean userObject,
- String samplingPropertyKey,
- Serializable samplingPropertyValue) {
- this.samplingPropertyKey = samplingPropertyKey;
- this.samplingPropertyValue = samplingPropertyValue;
- setUserObject(userObject);
- }
-
- public String getSamplingPropertyKey() {
- return samplingPropertyKey;
- }
-
- public Serializable getSamplingPropertyValue() {
- return samplingPropertyValue;
- }
-
- @Override
- public TraitSpeciesCatchBean getUserObject() {
- return (TraitSpeciesCatchBean) super.getUserObject();
- }
-
- @Override
- public CatchTreeNode getParent() {
- return (CatchTreeNode) super.getParent();
- }
-
- @Override
- public CatchTreeNode getRoot() {
- return (CatchTreeNode) super.getRoot();
- }
-
- @Override
- public CatchTreeNode getFirstChild() {
- return (CatchTreeNode) super.getFirstChild();
- }
-
- @Override
- public CatchTreeNode getLastChild() {
- return (CatchTreeNode) super.getLastChild();
- }
-
- @Override
- public CatchTreeNode getChildAfter(TreeNode aChild) {
- return (CatchTreeNode) super.getChildAfter(aChild);
- }
-
- @Override
- public CatchTreeNode getChildBefore(TreeNode aChild) {
- return (CatchTreeNode) super.getChildBefore(aChild);
- }
-
- @Override
- public CatchTreeNode getNextSibling() {
- return (CatchTreeNode) super.getNextSibling();
- }
-
- @Override
- public CatchTreeNode getPreviousSibling() {
- return (CatchTreeNode) super.getPreviousSibling();
- }
-
- @Override
- public CatchTreeNode getFirstLeaf() {
- return (CatchTreeNode) super.getFirstLeaf();
- }
-
- @Override
- public CatchTreeNode getLastLeaf() {
- return (CatchTreeNode) super.getLastLeaf();
- }
-
- @Override
- public CatchTreeNode getNextLeaf() {
- return (CatchTreeNode) super.getNextLeaf();
- }
-
- @Override
- public CatchTreeNode getPreviousLeaf() {
- return (CatchTreeNode) super.getPreviousLeaf();
- }
-
-}
Added: 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 (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,219 @@
+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 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.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+/**
+ * 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() {
+ return new FrequencyCellEditor();
+ }
+
+ public static class FrequencyCellEditor extends AbstractCellEditor implements TableCellEditor {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final FrequencyCellComponent component;
+
+ protected SpeciesBatchTableModel tableModel;
+
+ protected SpeciesBatchColumnIdentifier columnIdentifier;
+
+ protected SpeciesBatchRowModel editRow;
+
+ protected Integer rowIndex;
+
+ public FrequencyCellEditor() {
+ 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);
+ }
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ int row,
+ int column) {
+ if (tableModel == null) {
+ tableModel = (SpeciesBatchTableModel) table.getModel();
+
+ columnIdentifier = tableModel.getPropertyName(column);
+ }
+ String text;
+ if (value == null) {
+ text = " - ";
+ } else {
+ text = String.valueOf(value);
+ }
+ component.setText(text);
+
+ rowIndex = row;
+
+ editRow = tableModel.getEntry(row);
+
+ return component;
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+
+ Preconditions.checkNotNull(editRow, "No editRow found in editor.");
+
+ // update from computed frequencies
+ editRow.updateTotalFromFrequencies();
+
+ Object result;
+ if (columnIdentifier == SpeciesBatchColumnIdentifier.computedNumber) {
+ 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;
+ }
+ return b;
+ }
+
+ @Override
+ public void cancelCellEditing() {
+ super.cancelCellEditing();
+ rowIndex = 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/catches/species/FrequencyCellComponent.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,98 +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 org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JTable;
-import java.awt.event.ActionEvent;
-
-/**
- * Action to select next editable cell in a table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MoveToNextEditableCellAction extends AbstractSelectTableAction {
-
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(MoveToNextEditableCellAction.class);
-
- public MoveToNextEditableCellAction(SpeciesTabUIModel model,
- JTable table) {
- super(model, table);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
-
- int currentRow = getSelectedRow();
- int currentColumn = getSelectedColumn();
-
- if (log.isDebugEnabled()) {
- log.debug("Move to previous editable cell " +
- getCellCoordinate(currentRow, currentColumn));
- }
-
- int columnCount = getColumnCount();
-
- int rowCount = getRowCount();
-
- while (currentRow <= rowCount || currentColumn <= columnCount) {
-
- // go to next cell
- currentColumn++;
-
- // select next cell
- if (currentColumn >= columnCount) {
-
- // no more cell, so will move to next editable column on next row
- currentColumn = 0;
- currentRow++;
-
- if (currentRow == rowCount) {
- // create a new row in model
- getModel().addNewCatch();
- }
- }
-
- if (isCellEditable(currentRow, currentColumn)) {
-
- doSelectCell(currentRow, currentColumn);
-
- break;
- } else {
- if (log.isDebugEnabled()) {
- log.debug("Cell not editable at " +
- getCellCoordinate(currentRow, currentColumn));
- }
- }
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,82 +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 org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JTable;
-import java.awt.event.ActionEvent;
-
-/**
- * Action to select next editable row in a table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MoveToNextEditableRowAction extends AbstractSelectTableAction {
-
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(MoveToNextEditableRowAction.class);
-
- public MoveToNextEditableRowAction(SpeciesTabUIModel model,
- JTable table) {
- super(model, table);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- int currentRow = getSelectedRow();
- int currentColumn = getSelectedColumn();
-
- if (isCellEditable(currentRow, currentColumn)) {
- if (log.isDebugEnabled()) {
- log.debug("Move to next row editable cell " +
- getCellCoordinate(currentRow, currentColumn));
- }
- currentRow++;
-
- if (currentRow >= getRowCount()) {
- if (log.isDebugEnabled()) {
- log.debug("No next row");
- }
-
- // create a new row in model
- getModel().addNewCatch();
- }
-
- doSelectCell(currentRow, currentColumn);
-
- } else {
- if (log.isDebugEnabled()) {
- log.debug("Cell not editable at " +
- getCellCoordinate(currentRow, currentColumn));
- }
- }
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,87 +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 org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JTable;
-import java.awt.event.ActionEvent;
-
-/**
- * Action to select previous editable cell in a table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MoveToPreviousEditableCellAction extends AbstractSelectTableAction {
-
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(MoveToPreviousEditableCellAction.class);
-
- public MoveToPreviousEditableCellAction(SpeciesTabUIModel model,
- JTable table) {
- super(model,table);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- int currentRow = getSelectedRow();
- int currentColumn = getSelectedColumn();
-
- if (log.isDebugEnabled()) {
- log.debug("Move to previous editable cell, " +
- getCellCoordinate(currentRow, currentColumn));
- }
-
- int columnCount = getColumnCount();
-
- while (currentRow > 0 || currentColumn > 0) {
-
- // go to next cell
- currentColumn--;
-
- // select next cell
- if (currentColumn < 0) {
-
- currentColumn = columnCount - 1;
- currentRow--;
- }
-
- if (isCellEditable(currentRow, currentColumn)) {
- doSelectCell(currentRow, currentColumn);
- break;
- } else {
- if (log.isDebugEnabled()) {
- log.debug("Cell not editable at " +
- getCellCoordinate(currentRow, currentColumn));
- }
- }
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,79 +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 org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JTable;
-import java.awt.event.ActionEvent;
-
-/**
- * Action to select previous editable row in a table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MoveToPreviousEditableRowAction extends AbstractSelectTableAction {
-
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(MoveToPreviousEditableRowAction.class);
-
- public MoveToPreviousEditableRowAction(SpeciesTabUIModel model,
- JTable table) {
- super(model,table);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
-
- int currentRow = getSelectedRow();
- int currentColumn = getSelectedColumn();
-
- if (isCellEditable(currentRow, currentColumn)) {
- if (log.isDebugEnabled()) {
- log.debug("Move to previous row editable cell " +
- getCellCoordinate(currentRow, currentColumn));
- }
- currentRow--;
-
- if (currentRow < 0) {
- if (log.isDebugEnabled()) {
- log.debug("No previous row");
- }
- } else {
- doSelectCell(currentRow, currentColumn);
- }
- } else {
- if (log.isDebugEnabled()) {
- log.debug("Cell not editable at " +
- getCellCoordinate(currentRow, currentColumn));
- }
- }
- }
-}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,132 @@
+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.ui.swing.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractColumnIdentifier;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public enum SpeciesBatchColumnIdentifier implements AbstractColumnIdentifier<SpeciesBatchRowModel> {
+
+ speciesToConfirm(
+ n_("tutti.table.species.batch.header.toConfirm"),
+ n_("tutti.table.species.batch.header.toConfirm")),
+ speciesByCode(
+ "species",
+ n_("tutti.table.species.batch.header.speciesByCode"),
+ n_("tutti.table.species.batch.header.speciesByCode")),
+ speciesByGenusCode(
+ "species",
+ n_("tutti.table.species.batch.header.speciesByGenusCode"),
+ n_("tutti.table.species.batch.header.speciesByGenusCode")),
+ vracHorsVrac(
+ n_("tutti.table.species.batch.header.vracHorsVrac"),
+ n_("tutti.table.species.batch.header.vracHorsVrac")),
+ weightCategory(
+ n_("tutti.table.species.batch.header.weightCategory"),
+ n_("tutti.table.species.batch.header.weightCategory")),
+ sex(
+ n_("tutti.table.species.batch.header.sex"),
+ n_("tutti.table.species.batch.header.sex")),
+ maturity(
+ n_("tutti.table.species.batch.header.maturity"),
+ n_("tutti.table.species.batch.header.maturity")),
+ age(
+ n_("tutti.table.species.batch.header.age"),
+ n_("tutti.table.species.batch.header.age")),
+ weight(
+ n_("tutti.table.species.batch.header.weight"),
+ n_("tutti.table.species.batch.header.weight")),
+ computedWeight(
+ n_("tutti.table.species.batch.header.computedWeight"),
+ n_("tutti.table.species.batch.header.computedWeight")),
+ computedNumber(
+ n_("tutti.table.species.batch.header.computedNumber"),
+ n_("tutti.table.species.batch.header.computedNumber")),
+ sampleWeight(
+ n_("tutti.table.species.batch.header.sampleWeight"),
+ n_("tutti.table.species.batch.header.sampleWeight")),
+ elevationRatio(
+ n_("tutti.table.species.batch.header.elevationRate"),
+ n_("tutti.table.species.batch.header.elevationRate")),
+ comment(
+ n_("tutti.table.species.batch.header.comment"),
+ n_("tutti.table.species.batch.header.comment")),
+ file(
+ null,
+ n_("tutti.table.species.batch.header.file"),
+ n_("tutti.table.species.batch.header.file"));
+
+ private final String propertyName;
+
+ private final String headerI18nKey;
+
+ private final String headerTipI18nKey;
+
+ SpeciesBatchColumnIdentifier(String headerI18nKey, String headerTipI18nKey) {
+ this("", headerI18nKey, headerTipI18nKey);
+ }
+
+ SpeciesBatchColumnIdentifier(String propertyName, String headerI18nKey, String headerTipI18nKey) {
+ this.propertyName = "".equals(propertyName) ? name() : propertyName;
+ this.headerI18nKey = headerI18nKey;
+ this.headerTipI18nKey = headerTipI18nKey;
+ }
+
+ @Override
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ @Override
+ public String getHeaderI18nKey() {
+ return headerI18nKey;
+ }
+
+ @Override
+ public String getHeaderTipI18nKey() {
+ return headerTipI18nKey;
+ }
+
+ @Override
+ public Object getValue(SpeciesBatchRowModel entry) {
+ Object result = null;
+ if (propertyName != null && entry != null) {
+ result = TuttiUIUtil.getProperty(entry, propertyName);
+ }
+ return result;
+ }
+
+ @Override
+ public void setValue(SpeciesBatchRowModel entry, Object value) {
+ if (propertyName != null)
+ TuttiUIUtil.setProperty(entry, propertyName, value);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,371 @@
+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.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_ELEVATION_RATIO = "elevationRatio";
+
+ 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 elevationRatio;
+
+ /**
+ * 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);
+
+ for (SpeciesBatchFrequency frequencyBean : frequencies) {
+ SpeciesFrequencyRowModel f = new SpeciesFrequencyRowModel();
+ f.fromBean(frequencyBean);
+ frequency.add(f);
+ }
+ 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();
+ totalWeight += frequencyModel.getComputedWeight();
+ }
+ }
+
+ 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 getElevationRatio() {
+ return elevationRatio;
+ }
+
+ public void setElevationRatio(Float elevationRatio) {
+ Object oldValue = getElevationRatio();
+ this.elevationRatio = elevationRatio;
+ firePropertyChange(PROPERTY_ELEVATION_RATIO, oldValue, elevationRatio);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public 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/catches/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/catches/species/SpeciesBatchTableModel.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,110 @@
+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 javax.swing.table.TableColumnModel;
+import java.util.Set;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesBatchTableModel extends AbstractTuttiTableModel<SpeciesBatchRowModel, SpeciesBatchColumnIdentifier> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final Set<SpeciesBatchColumnIdentifier> noneEditableColIfNoSpecies = Sets.newHashSet(
+ SpeciesBatchColumnIdentifier.computedNumber,
+ SpeciesBatchColumnIdentifier.computedWeight
+ );
+
+ public SpeciesBatchTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ // TODO This will be dynamic by the protocol...
+ setNoneEditableCols(
+ SpeciesBatchColumnIdentifier.age,
+ SpeciesBatchColumnIdentifier.maturity,
+ SpeciesBatchColumnIdentifier.sampleWeight,
+ SpeciesBatchColumnIdentifier.elevationRatio,
+ SpeciesBatchColumnIdentifier.file
+ );
+ }
+
+ @Override
+ protected SpeciesBatchRowModel createNewRow() {
+ return new SpeciesBatchRowModel();
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ SpeciesBatchColumnIdentifier propertyName,
+ SpeciesBatchRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+
+ if (propertyName == SpeciesBatchColumnIdentifier.speciesByCode) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SpeciesBatchColumnIdentifier.speciesByGenusCode,
+ SpeciesBatchColumnIdentifier.computedNumber,
+ SpeciesBatchColumnIdentifier.computedWeight);
+
+ } else if (propertyName == SpeciesBatchColumnIdentifier.speciesByGenusCode) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SpeciesBatchColumnIdentifier.speciesByCode,
+ SpeciesBatchColumnIdentifier.computedNumber,
+ SpeciesBatchColumnIdentifier.computedWeight);
+ }
+ }
+
+ @Override
+ protected boolean isCellEditable(int rowIndex,
+ int columnIndex,
+ SpeciesBatchColumnIdentifier 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/catches/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/catches/species/SpeciesBatchTreeModel.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,102 @@
+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.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/catches/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/catches/species/SpeciesBatchTreeNode.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,152 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.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/catches/species/SpeciesBatchTreeNode.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,265 +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.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.VracHorsVracEnum;
-import fr.ifremer.tutti.persistence.entities.referential.SexBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.BinderFactory;
-
-/**
- * represents a row in the table
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class SpeciesCatchEntryModel extends AbstractTuttiBeanUIModel {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_SPECIES = "species";
-
- public static final String PROPERTY_SPECIES_TO_CONFIRM = "speciesToConfirm";
-
- public static final String PROPERTY_VRAC_HORS_VRAC = "vracHorsVrac";
-
- public static final String PROPERTY_WEIGHT_CATEGORY = "weightCategory";
-
- public static final String PROPERTY_SEX = "sex";
-
- public static final String PROPERTY_MATURITY = "maturity";
-
- public static final String PROPERTY_AGE = "age";
-
- public static final String PROPERTY_WEIGHT = "weight";
-
- public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
-
- public static final String PROPERTY_ELEVATION_RATIO = "elevationRatio";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- /**
- * Species observed.
- *
- * @since 0.2
- */
- protected SpeciesBean species;
-
- /**
- * Is the species need to be confirmed?.
- *
- * @since 0.2
- */
- protected boolean speciesToConfirm;
-
- /**
- * Is catch is vrac or horsVrac?.
- *
- * @since 0.2
- */
- protected VracHorsVracEnum vracHorsVrac;
-
- /**
- * Weight category (can be null).
- *
- * @since 0.2
- */
- protected WeightCategoryBean weightCategory;
-
- /**
- * Sex (can be null).
- *
- * @since 0.2
- */
- protected SexBean sex;
-
- /**
- * Maturity (can be null).
- *
- * @since 0.2
- */
- protected Float maturity;
-
- /**
- * Age (can be null).
- *
- * @since 0.2
- */
- protected Float age;
-
- /**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- /**
- * Sample weight.
- *
- * @since 0.2
- */
- protected Float sampleWeight;
-
- /**
- * Elevation ratio.
- *
- * @since 0.2
- */
- protected Float elevationRatio;
-
- /**
- * Comment on this catches.
- *
- * @since 0.2
- */
- protected String comment;
-
- public SpeciesBean getSpecies() {
- return species;
- }
-
- public void setSpecies(SpeciesBean species) {
- Object oldValue = getSpecies();
- this.species = species;
- firePropertyChange(PROPERTY_SPECIES, oldValue, species);
- }
-
- public Boolean getSpeciesToConfirm() {
- return speciesToConfirm;
- }
-
- public void setSpeciesToConfirm(Boolean speciesToConfirm) {
- Object oldValue = getSpeciesToConfirm();
- this.speciesToConfirm = speciesToConfirm;
- firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
- }
-
- public VracHorsVracEnum getVracHorsVrac() {
- return vracHorsVrac;
- }
-
- public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) {
- Object oldValue = getVracHorsVrac();
- this.vracHorsVrac = vracHorsVrac;
- firePropertyChange(PROPERTY_VRAC_HORS_VRAC, oldValue, vracHorsVrac);
- }
-
- public WeightCategoryBean getWeightCategory() {
- return weightCategory;
- }
-
- public void setWeightCategory(WeightCategoryBean weightCategory) {
- Object oldValue = getWeightCategory();
- this.weightCategory = weightCategory;
- firePropertyChange(PROPERTY_WEIGHT_CATEGORY, oldValue, weightCategory);
- }
-
- public SexBean getSex() {
- return sex;
- }
-
- public void setSex(SexBean sex) {
- Object oldValue = getSex();
- this.sex = sex;
- firePropertyChange(PROPERTY_SEX, oldValue, sex);
- }
-
- public Float getMaturity() {
- return maturity;
- }
-
- public void setMaturity(Float maturity) {
- Object oldValue = getMaturity();
- this.maturity = maturity;
- firePropertyChange(PROPERTY_MATURITY, oldValue, maturity);
- }
-
- public Float getAge() {
- return age;
- }
-
- public void setAge(Float age) {
- Object oldValue = getAge();
- this.age = age;
- firePropertyChange(PROPERTY_AGE, oldValue, age);
- }
-
- public Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- Object oldValue = getWeight();
- this.weight = weight;
- firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
- }
-
- public Float getSampleWeight() {
- return sampleWeight;
- }
-
- public void setSampleWeight(Float sampleWeight) {
- Object oldValue = getSampleWeight();
- this.sampleWeight = sampleWeight;
- firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
- }
-
- public Float getElevationRatio() {
- return elevationRatio;
- }
-
- public void setElevationRatio(Float elevationRatio) {
- Object oldValue = getElevationRatio();
- this.elevationRatio = elevationRatio;
- firePropertyChange(PROPERTY_ELEVATION_RATIO, oldValue, elevationRatio);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public void fromBean(TraitSpeciesCatchBean bean) {
- BinderFactory.newBinder(TraitSpeciesCatchBean.class,
- SpeciesCatchEntryModel.class).copy(bean, this);
- }
-
- public TraitSpeciesCatchBean toBean() {
- TraitSpeciesCatchBean result = new TraitSpeciesCatchBean();
- BinderFactory.newBinder(SpeciesCatchEntryModel.class,
- TraitSpeciesCatchBean.class).copy(this, result);
- return result;
- }
-}
Modified: 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-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css 2012-12-06 17:03:05 UTC (rev 30)
@@ -81,4 +81,5 @@
selectionMode:{ListSelectionModel.SINGLE_SELECTION};
selectionBackground:{null};
selectionForeground:{Color.BLACK};
+ sortable:false;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,7 +25,7 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesTabUIModel, SpeciesTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.data.Trait
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
@@ -52,7 +52,7 @@
handler.beforeInitUI();
}
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+public void selectTrait(Trait trait) { handler.selectTrait(trait); }
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -25,61 +25,37 @@
*/
import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.TuttiBeans;
-import fr.ifremer.tutti.persistence.entities.VracHorsVracEnum;
-import fr.ifremer.tutti.persistence.entities.referential.SexBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
+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.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
-import jaxx.runtime.SwingUtil;
-import jaxx.runtime.swing.JAXXWidgetUtil;
-import jaxx.runtime.swing.editor.EnumEditor;
-import jaxx.runtime.swing.editor.bean.BeanUIUtil;
-import jaxx.runtime.swing.editor.cell.NumberCellEditor;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
-import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
-import org.jdesktop.swingx.table.TableColumnExt;
import org.nuiton.util.beans.BeanMonitor;
import org.nuiton.util.decorator.Decorator;
-import javax.swing.JComboBox;
-import javax.swing.ListSelectionModel;
-import javax.swing.border.LineBorder;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import java.awt.Color;
-import java.awt.Component;
-import java.awt.event.FocusEvent;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
import java.util.List;
-import static fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTableModel.ColumnIdentifier;
-import static org.nuiton.i18n.I18n._;
-
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class SpeciesTabUIHandler extends AbstractTuttiUIHandler<SpeciesTabUIModel> {
+public class SpeciesTabUIHandler extends AbstractTuttiTableUIHandler<SpeciesBatchRowModel, SpeciesBatchColumnIdentifier, SpeciesBatchTableModel, SpeciesTabUIModel> {
/** Logger. */
private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
@@ -90,27 +66,24 @@
private final PersistenceService persistenceService;
- private final BeanMonitor rowMonitor;
-
private final BeanMonitor traitMonitor;
public SpeciesTabUIHandler(CatchesUI parentUi, SpeciesTabUI ui) {
- super(parentUi.getHandler().getContext());
+ 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_ELEVATION_RATIO,
+ SpeciesBatchRowModel.PROPERTY_COMMENT);
this.ui = ui;
this.parentUi = parentUi;
this.persistenceService = context.getService(PersistenceService.class);
- rowMonitor = new BeanMonitor(
- SpeciesCatchEntryModel.PROPERTY_SPECIES,
- SpeciesCatchEntryModel.PROPERTY_SPECIES_TO_CONFIRM,
- SpeciesCatchEntryModel.PROPERTY_VRAC_HORS_VRAC,
- SpeciesCatchEntryModel.PROPERTY_WEIGHT_CATEGORY,
- SpeciesCatchEntryModel.PROPERTY_SEX,
- SpeciesCatchEntryModel.PROPERTY_MATURITY,
- SpeciesCatchEntryModel.PROPERTY_AGE,
- SpeciesCatchEntryModel.PROPERTY_WEIGHT,
- SpeciesCatchEntryModel.PROPERTY_SAMPLE_WEIGHT,
- SpeciesCatchEntryModel.PROPERTY_ELEVATION_RATIO,
- SpeciesCatchEntryModel.PROPERTY_COMMENT);
traitMonitor = new BeanMonitor(
SpeciesTabUIModel.PROPERTY_SAMPLE_VRAC_WEIGHT,
SpeciesTabUIModel.PROPERTY_TOTAL_HORS_VRAC_WEIGHT,
@@ -120,6 +93,16 @@
}
@Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected SpeciesTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
public void beforeInitUI() {
SpeciesTabUIModel model = new SpeciesTabUIModel();
@@ -133,173 +116,109 @@
initUI(ui);
- JXTable table = ui.getTable();
+ JXTable table = getTable();
// create table column model
TableColumnModel columnModel = createTableColumnModel(table);
- SpeciesTabUIModel model = ui.getModel();
-
// create table model
- final SpeciesTableModel tableModel = new SpeciesTableModel(columnModel, model);
+ SpeciesBatchTableModel tableModel =
+ new SpeciesBatchTableModel(columnModel);
- // when model datas change let's propagate it
-
- model.addPropertyChangeListener(SpeciesTabUIModel.PROPERTY_ROWS, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.refreshData((List<SpeciesCatchEntryModel>) evt.getNewValue());
- }
- });
- model.addPropertyChangeListener(SpeciesTabUIModel.PROPERTY_NEW_ROW, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.addNewRow((SpeciesCatchEntryModel) evt.getNewValue());
- }
- });
-
-
table.setModel(tableModel);
table.setColumnModel(columnModel);
+ installTableKeyListener(columnModel, table);
+
table.getTableHeader().setReorderingAllowed(false);
table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
- table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+ // when model datas change let's propagate it table model
+ listenRowsFromModel();
- @Override
- public void valueChanged(ListSelectionEvent e) {
- if (!e.getValueIsAdjusting()) {
- ListSelectionModel source = (ListSelectionModel) e.getSource();
- int selectedRow = source.getLeadSelectionIndex();
+ // save when row chaged and was modified
+ listenRowModification(table);
+ }
- // save selected entry if required
- saveSelectedRowIfRequired();
-
- if (log.isInfoEnabled()) {
- log.info("New selected row: " + selectedRow);
- }
-
- SpeciesCatchEntryModel entry;
-
- if (selectedRow == -1) {
- // no selection
- entry = null;
- } else {
- entry = tableModel.getEntry(selectedRow);
- }
-
- if (log.isInfoEnabled()) {
- log.info("Will monitor entry: " + entry);
- }
- rowMonitor.setBean(entry);
- }
- }
- });
+ @Override
+ public void onCloseUI() {
}
- public void saveSelectedRowIfRequired(FocusEvent event) {
- Component oppositeComponent = event.getOppositeComponent();
+ @Override
+ protected void saveRow(SpeciesBatchRowModel row) {
+ SpeciesBatch catchBean = row.toBean();
- JXTable parentContainer = null;
-
- if (oppositeComponent != null) {
-
- // check out if still on table
- parentContainer = SwingUtil.getParentContainer(
- oppositeComponent, JXTable.class);
+ Trait trait = getModel().getTrait();
+ catchBean.setTrait(trait);
+ if (log.isInfoEnabled()) {
+ log.info("Selected trait: " + trait.getId());
}
- if (parentContainer == null) {
+ if (TuttiEntities.isNew(catchBean)) {
- // out of the table can save
- saveSelectedRowIfRequired();
+ catchBean = persistenceService.createSpeciesBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.saveSpeciesBatch(catchBean);
}
}
- public void saveSelectedRowIfRequired() {
+ public void selectTrait(Trait bean) {
- SpeciesCatchEntryModel bean = (SpeciesCatchEntryModel) rowMonitor.getBean();
- if (bean != null) {
+ JXTable table = ui.getTable();
- // there is a bean attached to the monitor
+ if (table.isEditing()) {
- if (rowMonitor.wasModified()) {
-
- // monitored bean was modified, save it
- if (log.isInfoEnabled()) {
- log.info("Row " + bean + " was modified, will save it");
- }
-
- TraitSpeciesCatchBean catchBean = bean.toBean();
-
- TraitBean trait = getModel().getTrait();
- catchBean.setTrait(trait);
- if (log.isInfoEnabled()) {
- log.info("Selected trait: " + trait.getId());
- }
-
- if (TuttiBeans.isNew(catchBean)) {
-
- catchBean = persistenceService.createTraitSpeciesCatch(catchBean);
- bean.setId(catchBean.getId());
- } else {
- persistenceService.saveTraitSpeciesCatch(catchBean);
- }
-
- // clear modified flag on the monitor
- rowMonitor.clearModified();
- }
+ // make sure to stop editor
+ table.editingCanceled(null);
}
- }
- @Override
- public void onCloseUI() {
- }
-
- public void selectTrait(TraitBean bean) {
-
if (traitMonitor.wasModified()) {
// previous trait was modified, let's save it
SpeciesTabUIModel traitMonitorBean =
(SpeciesTabUIModel) traitMonitor.getBean();
- TraitBean traitBean = traitMonitorBean.toBean();
+ Trait trait = traitMonitorBean.toBean();
if (log.isInfoEnabled()) {
- log.info("Trait " + traitBean.getId() +
+ log.info("Trait " + trait.getId() +
" was modified, will save it.");
}
- persistenceService.saveTrait(traitBean);
+ persistenceService.saveTrait(trait);
}
// make sure selection is empty (will remove bean from monitor)
- ui.getTable().clearSelection();
+ table.clearSelection();
boolean empty = bean == null;
SpeciesTabUIModel model = getModel();
- List<SpeciesCatchEntryModel> rows;
+ List<SpeciesBatchRowModel> rows;
if (empty) {
rows = null;
- bean = new TraitBean();
+ bean = new Trait();
model.setTrait(null);
} else {
if (log.isInfoEnabled()) {
- log.info("Get species catches for trait: " + bean.getId());
+ log.info("Get species batch for trait: " + bean.getId());
}
- List<TraitSpeciesCatchBean> catches =
- persistenceService.getAllTraitSpeciesCatch(bean.getId());
rows = Lists.newArrayList();
- for (TraitSpeciesCatchBean aCatch : catches) {
- SpeciesCatchEntryModel entry = new SpeciesCatchEntryModel();
- entry.fromBean(aCatch);
- rows.add(entry);
+
+ 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);
}
@@ -307,297 +226,141 @@
model.fromBean(bean);
model.setRows(rows);
+ listenModifcationOnFirstRow();
- //monitor.setBean(null);
-
- rows = model.getRows();
- rowMonitor.setBean(rows.get(0));
-
traitMonitor.clearModified();
}
@Override
- protected SpeciesTabUIModel getModel() {
- return ui.getModel();
- }
-
protected TableColumnModel createTableColumnModel(JXTable table) {
- KeyListener keyAdapter = createTableKeyListener(getModel(), table);
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
- {
- NumberCellEditor<Float> editor =
- JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
- editor.getNumberEditor().setSelectAllTextOnError(true);
- editor.getNumberEditor().getTextField().addKeyListener(keyAdapter);
- editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
- table.setDefaultEditor(float.class, editor);
- table.setDefaultEditor(Float.class, editor);
- }
-
- // Boolean
- {
- TableCellRenderer renderer = table.getDefaultRenderer(Boolean.class);
- table.setDefaultRenderer(boolean.class, renderer);
-
- TableCellEditor editor = table.getDefaultEditor(Boolean.class);
- table.setDefaultEditor(boolean.class, editor);
- }
-
- table.addKeyListener(keyAdapter);
-
- // prepare the table column model
- DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
-
{ // Species to confirm
- addColumnToModel(columnModel,
- table.getDefaultEditor(Boolean.class),
- table.getDefaultRenderer(Boolean.class),
- _("tutti.table.species.header.toConfirm"),
- ColumnIdentifier.speciesToConfirm);
-
+ addBooleanColumnToModel(columnModel,
+ SpeciesBatchColumnIdentifier.speciesToConfirm,
+ table);
}
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ List<Species> allSpecies = persistenceService.getAllSpecies();
{ // Species (by code)
- Decorator<SpeciesBean> decorator = getDecorator(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE);
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
- JComboBox comboBox = new JComboBox();
- comboBox.setRenderer(newListCellRender(decorator));
- SwingUtil.fillComboBox(comboBox, allSpecies, null);
-
- ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
- BeanUIUtil.decorate(comboBox, converter);
- TableCellEditor editor = new ComboBoxCellEditor(comboBox);
- TableCellRenderer renderer =
- newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE);
-
- addColumnToModel(columnModel,
- editor,
- renderer,
- _("tutti.table.species.header.speciesByCode"),
- ColumnIdentifier.speciesByCode);
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchColumnIdentifier.speciesByCode,
+ decorator, allSpecies);
}
{ // Species (by genusCode)
- Decorator<SpeciesBean> decorator =
- getDecorator(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE);
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
- JComboBox comboBox = new JComboBox();
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchColumnIdentifier.speciesByGenusCode,
+ decorator, allSpecies);
- comboBox.setRenderer(newListCellRender(decorator));
- SwingUtil.fillComboBox(comboBox, allSpecies, null);
-
- ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
- BeanUIUtil.decorate(comboBox, converter);
-
- TableCellEditor editor = new ComboBoxCellEditor(comboBox);
- TableCellRenderer renderer = newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_GENUS);
-
- addColumnToModel(columnModel,
- editor,
- renderer,
- _("tutti.table.species.header.speciesByGenusCode"),
- ColumnIdentifier.speciesByGenusCode);
-
}
{ // Vrac / Hors vrac
- EnumEditor<VracHorsVracEnum> comboBox =
- EnumEditor.newEditor(VracHorsVracEnum.values());
- BeanUIUtil.decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION);
- TableCellEditor editor = new ComboBoxCellEditor(comboBox);
-
- addColumnToModel(columnModel,
- editor,
- table.getDefaultRenderer(Object.class),
- _("tutti.table.species.header.vracHorsVrac"),
- ColumnIdentifier.vracHorsVrac);
+ addComboEnumColumnToModel(columnModel,
+ SpeciesBatchColumnIdentifier.vracHorsVrac,
+ VracHorsVracEnum.values());
}
{ // Catégorie de poids
- Decorator<WeightCategoryBean> decorator =
- getDecorator(WeightCategoryBean.class, DecoratorService.BY_NAME);
+ Decorator<WeightCategory> decorator =
+ getDecorator(WeightCategory.class,
+ DecoratorService.BY_NAME);
- JComboBox comboBox = new JComboBox();
+ List<WeightCategory> data =
+ persistenceService.getAllWeightCategory();
- comboBox.setRenderer(newListCellRender(decorator));
- SwingUtil.fillComboBox(comboBox, persistenceService.getAllWeightCategories(), null);
-
- ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
- BeanUIUtil.decorate(comboBox, converter);
-
- TableCellEditor editor = new ComboBoxCellEditor(comboBox);
- TableCellRenderer renderer =
- newTableCellRender(WeightCategoryBean.class, DecoratorService.BY_NAME);
-
- addColumnToModel(columnModel,
- editor,
- renderer,
- _("tutti.table.species.header.weightCategory"),
- ColumnIdentifier.weightCategory);
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchColumnIdentifier.weightCategory,
+ decorator, data);
}
{ // Sex
- Decorator<SexBean> decorator =
- getDecorator(SexBean.class, DecoratorService.BY_NAME);
+ Decorator<Sex> decorator =
+ getDecorator(Sex.class, DecoratorService.BY_NAME);
- JComboBox comboBox = new JComboBox();
- comboBox.setRenderer(newListCellRender(decorator));
- SwingUtil.fillComboBox(comboBox, persistenceService.getAllSex(), null);
+ List<Sex> data = persistenceService.getAllSex();
- ObjectToStringConverter converter =
- BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
- BeanUIUtil.decorate(comboBox, converter);
-
- TableCellEditor editor = new ComboBoxCellEditor(comboBox);
- TableCellRenderer renderer =
- newTableCellRender(SexBean.class, DecoratorService.BY_NAME);
-
- addColumnToModel(columnModel,
- editor,
- renderer,
- _("tutti.table.species.header.sex"),
- ColumnIdentifier.sex);
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchColumnIdentifier.sex,
+ decorator, data);
}
{ // Maturity
- addColumnToModel(columnModel,
- table.getDefaultEditor(Float.class),
- table.getDefaultRenderer(Object.class),
- _("tutti.table.species.header.maturity"),
- ColumnIdentifier.maturity);
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchColumnIdentifier.maturity,
+ TuttiUI.DECIMAL3_PATTERN
+ );
}
{ // Age
- addColumnToModel(columnModel,
- table.getDefaultEditor(Float.class),
- table.getDefaultRenderer(Object.class),
- _("tutti.table.species.header.age"),
- ColumnIdentifier.age);
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchColumnIdentifier.age,
+ TuttiUI.DECIMAL3_PATTERN);
}
{ // Poids observé
- addColumnToModel(columnModel,
- table.getDefaultEditor(Float.class),
- table.getDefaultRenderer(Object.class),
- _("tutti.table.species.header.weight"),
- ColumnIdentifier.weight);
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchColumnIdentifier.weight,
+ TuttiUI.DECIMAL3_PATTERN);
}
{ // Poids calculé
addColumnToModel(columnModel,
- null,
- table.getDefaultRenderer(Object.class),
- _("tutti.table.species.header.computedWeight"),
- ColumnIdentifier.computedWeight);
+ FrequencyCellComponent.newEditor(),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchColumnIdentifier.computedWeight);
}
{ // Nombre calculé
addColumnToModel(columnModel,
- null,
- table.getDefaultRenderer(Object.class),
- _("tutti.table.species.header.computedNumber"),
- ColumnIdentifier.computedNumber);
+ FrequencyCellComponent.newEditor(),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchColumnIdentifier.computedNumber);
}
{ // Poids d'échantillon
addColumnToModel(columnModel,
- null,
- table.getDefaultRenderer(Object.class),
- _("tutti.table.species.header.sampleWeight"),
- ColumnIdentifier.sampleWeight);
+ SpeciesBatchColumnIdentifier.sampleWeight);
}
{ // Fraction d'élévation
addColumnToModel(columnModel,
- null,
- table.getDefaultRenderer(Object.class),
- _("tutti.table.species.header.elevationRate"),
- ColumnIdentifier.elevationRatio);
+ SpeciesBatchColumnIdentifier.elevationRatio);
}
{ // Commentaire
addColumnToModel(columnModel,
- null,
- table.getDefaultRenderer(Object.class),
- _("tutti.table.species.header.comment"),
- ColumnIdentifier.comment);
+ SpeciesBatchColumnIdentifier.comment);
}
{ // Pièces-jointes
addColumnToModel(columnModel,
- null,
- table.getDefaultRenderer(Object.class),
- _("tutti.table.species.header.file"),
- ColumnIdentifier.file);
+ SpeciesBatchColumnIdentifier.file);
}
return columnModel;
}
-
- private KeyListener createTableKeyListener(SpeciesTabUIModel model, JXTable table) {
- final MoveToNextEditableCellAction nextCellAction = new MoveToNextEditableCellAction(model, table);
- final MoveToPreviousEditableCellAction previousCellAction = new MoveToPreviousEditableCellAction(model, table);
-
- final MoveToNextEditableRowAction nextRowAction = new MoveToNextEditableRowAction(model, table);
- final MoveToPreviousEditableRowAction previousRowAction = new MoveToPreviousEditableRowAction(model, table);
-
- // Key adapter à ajouter sur les éditeurs où l'on souhaite gérer les
- // touches "entrer", "gauche", "doite" de facon personnalisée.
- return new KeyAdapter() {
-
- @Override
- public void keyPressed(KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER ||
- e.getKeyCode() == KeyEvent.VK_RIGHT ||
- e.getKeyCode() == KeyEvent.VK_TAB) {
- e.consume();
- nextCellAction.actionPerformed(null);
- } else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
- e.consume();
- previousCellAction.actionPerformed(null);
- } else if (e.getKeyCode() == KeyEvent.VK_UP) {
- e.consume();
- previousRowAction.actionPerformed(null);
- } else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
- e.consume();
- nextRowAction.actionPerformed(null);
- } else if (e.getKeyCode() == KeyEvent.VK_DOWN && e.isControlDown()) {
- e.consume();
-
- // create a new line with same sample
- }
- }
- };
- }
-
- protected void addColumnToModel(TableColumnModel model,
- TableCellEditor editor,
- TableCellRenderer renderer,
- String header,
- Object identifier) {
-
- TableColumn col = new TableColumnExt(model.getColumnCount());
- col.setCellEditor(editor);
- col.setCellRenderer(renderer);
- col.setHeaderValue(header);
- col.setIdentifier(identifier);
- model.addColumn(col);
- }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -24,28 +24,19 @@
* #L%
*/
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.beans.AbstractSerializableBean;
+import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
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
*/
-public class SpeciesTabUIModel extends AbstractSerializableBean {
+public class SpeciesTabUIModel extends AbstractTuttiTableUIModel<Trait, SpeciesBatchRowModel, SpeciesTabUIModel> {
private static final long serialVersionUID = 1L;
- /** Logger. */
- private static final Log log = LogFactory.getLog(SpeciesTabUIModel.class);
-
public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
public static final String PROPERTY_TOTAL_VRAC_WEIGHT = "totalVracWeight";
@@ -54,12 +45,8 @@
public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
- public static final String PROPERTY_ROWS = "rows";
+ protected Trait trait;
- public static final String PROPERTY_NEW_ROW = "newRow";
-
- protected TraitBean trait;
-
protected Float totalWeight;
protected Float totalVracWeight;
@@ -68,32 +55,30 @@
protected Float totalHorsVracWeight;
- /**
- * List of catches (linear representation).
- *
- * @since 0.2
- */
- protected List<SpeciesCatchEntryModel> rows;
-
- protected final Binder<TraitBean, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(TraitBean.class, SpeciesTabUIModel.class)
+ protected static final Binder<Trait, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(Trait.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 final Binder<SpeciesTabUIModel, TraitBean> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesTabUIModel.class, TraitBean.class)
+ protected static final Binder<SpeciesTabUIModel, Trait> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesTabUIModel.class, Trait.class)
.addProperty(PROPERTY_TOTAL_WEIGHT, "speciesTotalWeight")
.addProperty(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, "speciesTotalHorsVracWeight")
.addProperty(PROPERTY_TOTAL_VRAC_WEIGHT, "speciesTotalVracWeight")
.addProperty(PROPERTY_SAMPLE_VRAC_WEIGHT, "speciesSampleVracWeight")
.toBinder();
- public TraitBean getTrait() {
+ public SpeciesTabUIModel() {
+ super(Trait.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public Trait getTrait() {
return trait;
}
- public void setTrait(TraitBean trait) {
+ public void setTrait(Trait trait) {
this.trait = trait;
}
@@ -101,10 +86,6 @@
return totalWeight;
}
- public int getRowCount() {
- return rows == null ? 0 : rows.size();
- }
-
public void setTotalWeight(Float totalWeight) {
Object oldValue = getTotalWeight();
this.totalWeight = totalWeight;
@@ -141,43 +122,9 @@
firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight);
}
- public List<SpeciesCatchEntryModel> getRows() {
- return rows;
+ @Override
+ protected Trait newEntity() {
+ return trait;
}
- public void setRows(List<SpeciesCatchEntryModel> rows) {
- Object oldValue = getRowCount();
- if (rows == null) {
- rows = Lists.newArrayList();
- }
- this.rows = rows;
- firePropertyChange(PROPERTY_ROWS, oldValue, rows);
- }
-
- public void addNewCatch() {
- Preconditions.checkState(
- rows != null,
- "Cant add a row, rows list is null");
- SpeciesCatchEntryModel newRow = new SpeciesCatchEntryModel();
- if (log.isInfoEnabled()) {
- log.info("Add a new catch ");
- }
- rows.add(newRow);
- firePropertyChange(PROPERTY_NEW_ROW, null, newRow);
- }
-
- public void fromBean(TraitBean bean) {
-
- fromBeanBinder.copy(bean, this);
- }
-
- public TraitBean toBean() {
- TraitBean result = trait;
- toBeanBinder.copy(this, result);
- return result;
- }
-
- public String getId() {
- return trait == null ? null : trait.getId();
- }
}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -1,209 +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 com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
-import jaxx.runtime.SwingUtil;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesTableModel extends AbstractTableModel {
-
- public static enum ColumnIdentifier {
- speciesToConfirm,
- speciesByCode("species"),
- speciesByGenusCode("species"),
- vracHorsVrac,
- weightCategory,
- sex,
- maturity,
- age,
- weight,
- computedWeight(null),
- computedNumber(null),
- sampleWeight,
- elevationRatio,
- comment,
- file(null);
-
- final String propertyName;
-
- ColumnIdentifier() {
- this("");
- }
-
- ColumnIdentifier(String propertyName) {
- this.propertyName = "".equals(propertyName) ? name() : propertyName;
- }
-
- public void setValue(SpeciesCatchEntryModel entry, Object value) {
- if (propertyName != null)
- TuttiUIUtil.setProperty(entry, propertyName, value);
- }
-
- public Object getValue(SpeciesCatchEntryModel entry) {
- Object result = null;
- if (propertyName != null && entry != null) {
- result = TuttiUIUtil.getProperty(entry, propertyName);
- }
- return result;
- }
- }
-
- private static final long serialVersionUID = 1L;
-
- // TODO This will be dynamic by the protocol...
- final Set<ColumnIdentifier> noneEditableCols = Sets.newHashSet(
- ColumnIdentifier.age,
- ColumnIdentifier.maturity,
- ColumnIdentifier.computedWeight,
- ColumnIdentifier.computedNumber,
- ColumnIdentifier.sampleWeight,
- ColumnIdentifier.elevationRatio,
- ColumnIdentifier.file
- );
-
- protected final List<ColumnIdentifier> columnIdentifiers;
-
- protected final TableColumn[] columns;
-
- protected final SpeciesTabUIModel model;
-
- public SpeciesTableModel(TableColumnModel columnModel,
- SpeciesTabUIModel model) {
- this.model = model;
- int nbcols = columnModel.getColumnCount();
- columns = new TableColumn[nbcols];
- columnIdentifiers = Lists.newArrayList();
- for (int i = 0; i < nbcols; i++) {
- TableColumn column = columnModel.getColumn(i);
- columns[i] = column;
- columnIdentifiers.add((ColumnIdentifier) column.getIdentifier());
- }
- }
-
- public void refreshData(List<SpeciesCatchEntryModel> data) {
-
- // can't accept a empty data list
- Preconditions.checkNotNull(data, "Data list can not be null.");
-
- if (data.isEmpty()) {
-
- // add a first edit line
- data.add(new SpeciesCatchEntryModel());
- }
- fireTableDataChanged();
- }
-
- public void addNewRow(SpeciesCatchEntryModel newValue) {
-
- List<SpeciesCatchEntryModel> data = getData();
- Preconditions.checkNotNull(data, "Data list can not be null.");
-
- int rowIndex = data.indexOf(newValue);
- fireTableRowsInserted(rowIndex, rowIndex);
- }
-
- @Override
- public int getRowCount() {
- return model.getRowCount();
- }
-
- @Override
- public int getColumnCount() {
- return columns.length;
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- SpeciesCatchEntryModel entry = getEntry(rowIndex);
- ColumnIdentifier propertyName = getPropertyName(columnIndex);
- Object result = propertyName.getValue(entry);
- return result;
- }
-
- @Override
- public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
- SpeciesCatchEntryModel entry = getEntry(rowIndex);
- ColumnIdentifier propertyName = getPropertyName(columnIndex);
- propertyName.setValue(entry, aValue);
-
- if (propertyName == ColumnIdentifier.speciesByCode) {
-
- // update also speciesByGenusCode column
- int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByGenusCode);
- fireTableCellUpdated(rowIndex, otherColumnIndex);
- } else if (propertyName == ColumnIdentifier.speciesByGenusCode) {
-
- // update also speciesByCode column
- int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByCode);
- fireTableCellUpdated(rowIndex, otherColumnIndex);
- }
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- ColumnIdentifier identifier = getPropertyName(columnIndex);
- boolean result = !noneEditableCols.contains(identifier);
- return result;
- }
-
- public SpeciesCatchEntryModel getEntry(int rowIndex) {
- SwingUtil.ensureRowIndex(this, rowIndex);
- List<SpeciesCatchEntryModel> data = getData();
- SpeciesCatchEntryModel result = data == null ? null : data.get(rowIndex);
- return result;
- }
-
- protected TableColumn getColumn(int columnIndex) {
- SwingUtil.ensureColumnIndex(this, columnIndex);
- return columns[columnIndex];
- }
-
- protected ColumnIdentifier getPropertyName(int columnIndex) {
- TableColumn column = getColumn(columnIndex);
- return (ColumnIdentifier) column.getIdentifier();
- }
-
- protected int getColumnIndex(ColumnIdentifier property) {
- int result = columnIdentifiers.indexOf(property);
- return result;
- }
-
- protected List<SpeciesCatchEntryModel> getData() {
- return model.getRows();
- }
-}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species.frequency;
+
+/*
+ * #%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.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractColumnIdentifier;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public enum SpeciesFrequencyColumnIdentifier implements AbstractColumnIdentifier<SpeciesFrequencyRowModel> {
+
+ lengthStep(
+ n_("tutti.table.species.frequency.header.lengthStep"),
+ n_("tutti.table.species.frequency.header.lengthStep")),
+ number(
+ n_("tutti.table.species.frequency.header.number"),
+ n_("tutti.table.species.frequency.header.number")),
+ weight(
+ n_("tutti.table.species.frequency.header.weight"),
+ n_("tutti.table.species.frequency.header.weight")),
+ computedWeight(
+ n_("tutti.table.species.frequency.header.computedWeight"),
+ n_("tutti.table.species.frequency.header.computedWeight"));
+
+ private final String propertyName;
+
+ private final String headerI18nKey;
+
+ private final String headerTipI18nKey;
+
+ SpeciesFrequencyColumnIdentifier(String headerI18nKey, String headerTipI18nKey) {
+ this("", headerI18nKey, headerTipI18nKey);
+ }
+
+ SpeciesFrequencyColumnIdentifier(String propertyName, String headerI18nKey, String headerTipI18nKey) {
+ this.propertyName = "".equals(propertyName) ? name() : propertyName;
+ this.headerI18nKey = headerI18nKey;
+ this.headerTipI18nKey = headerTipI18nKey;
+ }
+
+ @Override
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ @Override
+ public String getHeaderI18nKey() {
+ return headerI18nKey;
+ }
+
+ @Override
+ public String getHeaderTipI18nKey() {
+ return headerTipI18nKey;
+ }
+
+ @Override
+ public Object getValue(SpeciesFrequencyRowModel entry) {
+ Object result = null;
+ if (entry != null) {
+ result = TuttiUIUtil.getProperty(entry, propertyName);
+ }
+ return result;
+ }
+
+ @Override
+ public void setValue(SpeciesFrequencyRowModel entry, Object value) {
+ TuttiUIUtil.setProperty(entry, propertyName, value);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,129 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species.frequency;
+
+/*
+ * #%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.SpeciesBatchFrequency;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ * Represents a batch frequency row.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBatchFrequency, 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);
+
+ 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);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,61 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species.frequency;
+
+/*
+ * #%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.AbstractTuttiTableModel;
+
+import javax.swing.table.TableColumnModel;
+
+/**
+ * Model of the species frequency table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyTableModel extends AbstractTuttiTableModel<SpeciesFrequencyRowModel, SpeciesFrequencyColumnIdentifier> {
+
+ private static final long serialVersionUID = 1L;
+
+ public SpeciesFrequencyTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols(SpeciesFrequencyColumnIdentifier.weight);
+ }
+
+ @Override
+ protected SpeciesFrequencyRowModel createNewRow() {
+ return new SpeciesFrequencyRowModel();
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ SpeciesFrequencyColumnIdentifier propertyName,
+ SpeciesFrequencyRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+ // TODO Rebuild the computedWeight if possible...
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,44 @@
+/*
+ * #%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%
+ */
+#configurationPanel {
+ border:{new TitledBorder(null, _("tutti.label.frequencyConfiguration"))};
+}
+
+#saveButton {
+ actionIcon:"save";
+ text:"tutti.action.save";
+ enabled:{model.isModify() && model.isValid()};
+}
+
+#cancelButton {
+ actionIcon:"cancel";
+ text:"tutti.action.cancel";
+}
+
+#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/catches/species/frequency/SpeciesFrequencyUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,86 @@
+<!--
+ #%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.catches.species.SpeciesBatchRowModel
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+
+ org.jdesktop.swingx.JXTable
+
+ javax.swing.ListSelectionModel
+
+ 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)'/>
+
+ <JPanel id='configurationPanel' constraints='BorderLayout.NORTH'
+ layout='{new BorderLayout()}'>
+
+ <JPanel id='configurationModePanel' constraints='BorderLayout.WEST'>
+
+ </JPanel>
+
+
+
+ </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='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ </JPanel>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,185 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species.frequency;
+
+/*
+ * #%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.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+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.table.TableColumnModel;
+import java.awt.Color;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<SpeciesFrequencyRowModel, SpeciesFrequencyColumnIdentifier, SpeciesFrequencyTableModel, SpeciesFrequencyUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SpeciesFrequencyUIHandler.class);
+
+ private final SpeciesFrequencyUI ui;
+
+ private final PersistenceService persistenceService;
+
+ 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;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ SpeciesFrequencyUIModel model = new SpeciesFrequencyUIModel();
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ protected void saveRow(SpeciesFrequencyRowModel row) {
+
+ //TODO
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel(table);
+
+ // create table model
+ SpeciesFrequencyTableModel tableModel =
+ new SpeciesFrequencyTableModel(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);
+ }
+
+ @Override
+ public void onCloseUI() {
+// ui.getValidator().setBean(null);
+ }
+
+ @Override
+ protected SpeciesFrequencyUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void editBatch(SpeciesBatchRowModel row) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Will edit row: " + row);
+ }
+ getModel().fromBean(row);
+ }
+
+ public void cancel() {
+ if (log.isInfoEnabled()) {
+ log.info("Will cancel");
+ }
+ }
+
+ public void save() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+
+ SpeciesFrequencyUIModel model = getModel();
+
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel(JXTable table) {
+
+ DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
+
+ { // LengthStep
+
+ addFloatColumnToModel(columnModel,
+ SpeciesFrequencyColumnIdentifier.lengthStep,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Number
+
+ addIntegerColumnToModel(columnModel,
+ SpeciesFrequencyColumnIdentifier.number,
+ TuttiUI.INT_6_DIGITS_PATTERN);
+ }
+
+ { // weight
+
+ addFloatColumnToModel(columnModel,
+ SpeciesFrequencyColumnIdentifier.weight,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // computedWeight
+
+ addFloatColumnToModel(columnModel,
+ SpeciesFrequencyColumnIdentifier.computedWeight,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+ return columnModel;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,97 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species.frequency;
+
+/*
+ * #%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.content.catches.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderModelBuilder;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyUIModel extends AbstractTuttiTableUIModel<SpeciesBatchRowModel, SpeciesFrequencyRowModel, SpeciesFrequencyUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected static final Binder<SpeciesBatchRowModel, SpeciesFrequencyUIModel> fromBeanBinder =
+ BinderModelBuilder.newEmptyBuilder(SpeciesBatchRowModel.class, SpeciesFrequencyUIModel.class)
+ .addProperty(SpeciesBatchRowModel.PROPERTY_FREQUENCY, PROPERTY_ROWS)
+ .toBinder();
+
+ protected static final Binder<SpeciesFrequencyUIModel, SpeciesBatchRowModel> toBeanBinder =
+ BinderModelBuilder.newEmptyBuilder(SpeciesFrequencyUIModel.class, SpeciesBatchRowModel.class)
+ .addProperty(PROPERTY_ROWS, SpeciesBatchRowModel.PROPERTY_FREQUENCY)
+ .toBinder();
+
+ public static final String PROPERTY_CONFIGURATION_MODE = "configurationMode";
+
+ public static enum ConfigurationMode {
+
+ SIMPLE(n_("tutti.speciesFrequency.configurationMode.simple"),
+ n_("tutti.speciesFrequency.configurationMode.simple.tip")),
+ AUTO_GEN(n_("tutti.speciesFrequency.configurationMode.autoGenerate"),
+ n_("tutti.speciesFrequency.configurationMode.autoGenerate.tip")),
+ RAFALE(n_("tutti.speciesFrequency.configurationMode.rafale"),
+ n_("tutti.speciesFrequency.configurationMode.rafale.tip"));
+
+ private final String i18nKey;
+
+ private final String tipKey;
+
+ private ConfigurationMode(String i18nKey, String tipKey) {
+ this.i18nKey = i18nKey;
+ this.tipKey = tipKey;
+ }
+
+ public String getI18nKey() {
+ return i18nKey;
+ }
+
+ public String getTipKey() {
+ return tipKey;
+ }
+ }
+
+ protected ConfigurationMode configurationMode;
+
+ public SpeciesFrequencyUIModel() {
+ super(SpeciesBatchRowModel.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public ConfigurationMode getConfigurationMode() {
+ return configurationMode;
+ }
+
+ public void setConfigurationMode(ConfigurationMode configurationMode) {
+ Object oldValue = getConfigurationMode();
+ this.configurationMode = configurationMode;
+ firePropertyChange(PROPERTY_CONFIGURATION_MODE, oldValue, configurationMode);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,44 @@
+package fr.ifremer.tutti.ui.swing.util.table;
+
+/*
+ * #%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 java.io.Serializable;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public interface AbstractColumnIdentifier<R> extends Serializable {
+
+ String getPropertyName();
+
+ String getHeaderI18nKey();
+
+ String getHeaderTipI18nKey();
+
+ void setValue(R entry, Object value);
+
+ Object getValue(R entry);
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.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/util/table/AbstractSelectTableAction.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,98 @@
+package fr.ifremer.tutti.ui.swing.util.table;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.AbstractAction;
+import javax.swing.JTable;
+
+/**
+ * Abstract action to select something in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public abstract class AbstractSelectTableAction<M extends AbstractTuttiTableModel> extends AbstractAction {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(AbstractSelectTableAction.class);
+
+ private final JTable table;
+
+ private final M model;
+
+ public AbstractSelectTableAction(M model, JTable table) {
+ this.model = model;
+ this.table = table;
+ }
+
+ protected void doSelectCell(int rowIndex, int columnIndex) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Will select cell at " +
+ getCellCoordinate(rowIndex, columnIndex));
+ }
+
+ table.editCellAt(rowIndex, columnIndex);
+ table.setColumnSelectionInterval(columnIndex, columnIndex);
+ table.setRowSelectionInterval(rowIndex, rowIndex);
+ }
+
+
+ protected int getSelectedRow() {
+ int result = table.getSelectedRow();
+ return result;
+ }
+
+ protected int getSelectedColumn() {
+ int result = table.getSelectedColumn();
+ return result;
+ }
+
+ protected int getRowCount() {
+ return table.getRowCount();
+ }
+
+ protected int getColumnCount() {
+ return table.getColumnCount();
+ }
+
+ protected boolean isCellEditable(int rowIndex, int columnIndex) {
+ return table.isCellEditable(rowIndex, columnIndex);
+ }
+
+ protected String getCellCoordinate(int rowIndex, int columnIndex) {
+ return " [" + rowIndex + ", " + columnIndex + "]";
+ }
+
+ protected void addNewRow() {
+ model.addNewRow();
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,216 @@
+package fr.ifremer.tutti.ui.swing.util.table;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public abstract class AbstractTuttiTableModel<R extends Serializable, C extends AbstractColumnIdentifier<R>> extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(AbstractTuttiTableModel.class);
+
+ /**
+ * Column definition.
+ *
+ * @since 0.2
+ */
+ protected final TableColumn[] columns;
+
+ /**
+ * Column identifiers.
+ *
+ * @since 0.2
+ */
+ protected final List<C> columnIdentifiers;
+
+ /**
+ * Data in the model.
+ *
+ * @since 0.2
+ */
+ protected List<R> rows;
+
+ /**
+ * Set of non editable columns.
+ *
+ * @since 0.2
+ */
+ protected Set<C> noneEditableCols;
+
+ protected abstract R createNewRow();
+
+ protected AbstractTuttiTableModel(TableColumnModel columnModel) {
+ int nbcols = columnModel.getColumnCount();
+ columns = new TableColumn[nbcols];
+ columnIdentifiers = Lists.newArrayList();
+ for (int i = 0; i < nbcols; i++) {
+ TableColumn column = columnModel.getColumn(i);
+ columns[i] = column;
+ columnIdentifiers.add((C) column.getIdentifier());
+ }
+ }
+
+ public final List<R> getRows() {
+ return rows;
+ }
+
+ public final void setRows(List<R> data) {
+
+ // can't accept a empty data list
+ Preconditions.checkNotNull(data, "Data list can not be null.");
+
+ if (data.isEmpty()) {
+
+ // add a first edit line
+ data.add(createNewRow());
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Set " + data.size() + " row(s) in table model " + this);
+ }
+ this.rows = data;
+ fireTableDataChanged();
+ }
+
+ public final void addNewRow() {
+ R newValue = createNewRow();
+
+ List<R> data = getRows();
+ Preconditions.checkNotNull(data, "Data list can not be null.");
+ data.add(newValue);
+
+ int rowIndex = data.indexOf(newValue);
+ fireTableRowsInserted(rowIndex, rowIndex);
+ }
+
+ public final C getPropertyName(int columnIndex) {
+ TableColumn column = getColumn(columnIndex);
+ return (C) column.getIdentifier();
+ }
+
+ public final R getEntry(int rowIndex) {
+ SwingUtil.ensureRowIndex(this, rowIndex);
+ List<R> data = getRows();
+ R result = data == null ? null : data.get(rowIndex);
+ return result;
+ }
+
+ public final void setNoneEditableCols(C... noneEditableCols) {
+ this.noneEditableCols = Sets.newHashSet(noneEditableCols);
+ }
+
+ @Override
+ public final int getRowCount() {
+ return rows == null ? 0 : rows.size();
+ }
+
+ @Override
+ public final int getColumnCount() {
+ return columns.length;
+ }
+
+ @Override
+ public final Object getValueAt(int rowIndex, int columnIndex) {
+ R entry = getEntry(rowIndex);
+ C propertyName = getPropertyName(columnIndex);
+ Object result = getValueAt(rowIndex, columnIndex, propertyName, entry);
+ return result;
+ }
+
+ @Override
+ public final void setValueAt(Object aValue, int rowIndex, int columnIndex) {
+ R entry = getEntry(rowIndex);
+ C propertyName = getPropertyName(columnIndex);
+ setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+ }
+
+ @Override
+ public final boolean isCellEditable(int rowIndex, int columnIndex) {
+ C identifier = getPropertyName(columnIndex);
+ boolean result = isCellEditable(rowIndex, columnIndex, identifier);
+ return result;
+ }
+
+ protected Object getValueAt(int rowIndex,
+ int columnIndex,
+ C propertyName,
+ R entry) {
+ Object result = propertyName.getValue(entry);
+ return result;
+ }
+
+ protected void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ C propertyName,
+ R entry) {
+ propertyName.setValue(entry, aValue);
+ }
+
+ protected boolean isCellEditable(int rowIndex,
+ int columnIndex,
+ C propertyName) {
+ boolean result = !noneEditableCols.contains(propertyName);
+ return result;
+ }
+
+ protected final void fireTableCellUpdated(int rowIndex,
+ C... identifiers) {
+ for (C identifier : identifiers) {
+ int columnIndex = getColumnIndex(identifier);
+ fireTableCellUpdated(rowIndex, columnIndex);
+ }
+ }
+
+ protected final TableColumn getColumn(int columnIndex) {
+ SwingUtil.ensureColumnIndex(this, columnIndex);
+ return columns[columnIndex];
+ }
+
+ protected final int getColumnIndex(C property) {
+ int result = columnIdentifiers.indexOf(property);
+ return result;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,331 @@
+package fr.ifremer.tutti.ui.swing.util.table;
+
+/*
+ * #%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.AbstractTuttiBeanUIModel;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+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;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Enumeration;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIModel, C extends AbstractColumnIdentifier<R>, T extends AbstractTuttiTableModel<R, C>, M extends AbstractTuttiTableUIModel<?, R, M>> extends AbstractTuttiUIHandler<M> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(AbstractTuttiTableUIHandler.class);
+
+ /**
+ * Monitor the selected row (save it only if something has changed).
+ *
+ * @since 0.2
+ */
+ private final BeanMonitor rowMonitor;
+
+ protected AbstractTuttiTableUIHandler(TuttiUIContext context,
+ String... properties) {
+ super(context);
+ rowMonitor = new BeanMonitor(properties);
+ }
+
+ protected KeyListener installTableKeyListener(TableColumnModel columnModel, JTable table) {
+
+ T model = getTableModel();
+ final MoveToNextEditableCellAction nextCellAction =
+ MoveToNextEditableCellAction.newAction(model, table);
+ final MoveToPreviousEditableCellAction previousCellAction =
+ MoveToPreviousEditableCellAction.newAction(model, table);
+
+ final MoveToNextEditableRowAction nextRowAction =
+ MoveToNextEditableRowAction.newAction(model, table);
+ final MoveToPreviousEditableRowAction previousRowAction =
+ MoveToPreviousEditableRowAction.newAction(model, table);
+
+ // Key adapter à ajouter sur les éditeurs où l'on souhaite gérer les
+ // touches "entrer", "gauche", "droite" de facon personnalisée.
+ KeyAdapter keyAdapter = new KeyAdapter() {
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER ||
+ e.getKeyCode() == KeyEvent.VK_RIGHT ||
+ e.getKeyCode() == KeyEvent.VK_TAB) {
+ e.consume();
+ nextCellAction.actionPerformed(null);
+ } else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
+ e.consume();
+ previousCellAction.actionPerformed(null);
+ } else if (e.getKeyCode() == KeyEvent.VK_UP) {
+ e.consume();
+ previousRowAction.actionPerformed(null);
+ } else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
+ e.consume();
+ nextRowAction.actionPerformed(null);
+ }
+ }
+ };
+ table.addKeyListener(keyAdapter);
+
+ Enumeration<TableColumn> columns = columnModel.getColumns();
+ while (columns.hasMoreElements()) {
+ TableColumn tableColumn = columns.nextElement();
+ TableCellEditor cellEditor = tableColumn.getCellEditor();
+ if (cellEditor instanceof NumberCellEditor) {
+ NumberCellEditor editor = (NumberCellEditor) cellEditor;
+ editor.getNumberEditor().getTextField().addKeyListener(keyAdapter);
+ }
+ }
+
+ return keyAdapter;
+ }
+
+ protected <C extends AbstractColumnIdentifier> void addColumnToModel(TableColumnModel model,
+ TableCellEditor editor,
+ TableCellRenderer renderer,
+ C identifier) {
+
+ TableColumn col = new TableColumnExt(model.getColumnCount());
+ col.setCellEditor(editor);
+ col.setCellRenderer(renderer);
+ col.setHeaderValue(_(identifier.getHeaderI18nKey()));
+ //TODO Use tip in a header renderer
+
+ col.setIdentifier(identifier);
+ model.addColumn(col);
+ }
+
+ protected <C extends AbstractColumnIdentifier> void addColumnToModel(TableColumnModel model,
+ C identifier) {
+
+ addColumnToModel(model, null, null, identifier);
+ }
+
+ protected <C extends AbstractColumnIdentifier> void addFloatColumnToModel(TableColumnModel model,
+ C identifier,
+ String numberPattern) {
+
+ NumberCellEditor<Float> editor =
+ JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
+ editor.getNumberEditor().setSelectAllTextOnError(true);
+ editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
+ editor.getNumberEditor().setNumberPattern(numberPattern);
+
+ addColumnToModel(model, editor, null, identifier);
+
+ }
+
+ protected <C extends AbstractColumnIdentifier> void addIntegerColumnToModel(TableColumnModel model,
+ C identifier,
+ String numberPattern) {
+
+ NumberCellEditor<Integer> editor =
+ JAXXWidgetUtil.newNumberTableCellEditor(Integer.class, false);
+ editor.getNumberEditor().setSelectAllTextOnError(true);
+ editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
+ editor.getNumberEditor().setNumberPattern(numberPattern);
+
+ addColumnToModel(model, editor, null, identifier);
+ }
+
+
+ protected <C extends AbstractColumnIdentifier> void addBooleanColumnToModel(TableColumnModel model,
+ C identifier,
+ JTable table) {
+
+ addColumnToModel(model,
+ table.getDefaultEditor(Boolean.class),
+ table.getDefaultRenderer(Boolean.class),
+ identifier);
+ }
+
+ protected <C extends AbstractColumnIdentifier, B> void addComboDataColumnToModel(TableColumnModel model,
+ C identifier,
+ Decorator<B> decorator, List<B> data) {
+ JComboBox comboBox = new JComboBox();
+ comboBox.setRenderer(newListCellRender(decorator));
+ SwingUtil.fillComboBox(comboBox, data, null);
+
+ ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
+ BeanUIUtil.decorate(comboBox, converter);
+ ComboBoxCellEditor editor = new ComboBoxCellEditor(comboBox);
+
+ addColumnToModel(model,
+ editor,
+ newTableCellRender(decorator),
+ identifier);
+ }
+
+ protected <C extends AbstractColumnIdentifier, B extends Enum<B>> void addComboEnumColumnToModel(TableColumnModel model,
+ C identifier,
+ B[] data) {
+ EnumEditor<B> comboBox =
+ EnumEditor.newEditor(data);
+ BeanUIUtil.decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION);
+ TableCellEditor editor = new ComboBoxCellEditor(comboBox);
+
+ addColumnToModel(model,
+ editor,
+ null,
+ identifier);
+ }
+
+ protected void listenRowsFromModel() {
+ getModel().addPropertyChangeListener(AbstractTuttiTableUIModel.PROPERTY_ROWS, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ getTableModel().setRows((List<R>) evt.getNewValue());
+ }
+ });
+ }
+
+ protected <O> TableCellRenderer newTableCellRender(Class<O> type) {
+
+ return newTableCellRender(type, null);
+ }
+
+ protected <O> TableCellRenderer newTableCellRender(Class<O> type, String name) {
+
+ Decorator<O> decorator = getDecorator(type, name);
+
+ TableCellRenderer result = newTableCellRender(decorator);
+ return result;
+ }
+
+ protected <O> TableCellRenderer newTableCellRender(Decorator<O> decorator) {
+
+ Preconditions.checkNotNull(decorator);
+
+ DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator);
+ return result;
+ }
+
+ protected void listenRowModification(JTable table) {
+ ListSelectionListener listener = new TableRowModificationListener(
+ getTableModel(), rowMonitor) {
+ @Override
+ protected void saveSelectedRow() {
+ saveSelectedRowIfRequired();
+ }
+ };
+ table.getSelectionModel().addListSelectionListener(listener);
+ }
+
+ 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(JXTable table);
+
+ protected abstract JTable getTable();
+
+ protected T getTableModel() {
+ return (T) getTable().getModel();
+ }
+
+ protected void listenModifcationOnFirstRow() {
+ List<R> rows = getTableModel().getRows();
+ if (CollectionUtils.isNotEmpty(rows)) {
+ rowMonitor.setBean(rows.get(0));
+ }
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,65 @@
+package fr.ifremer.tutti.ui.swing.util.table;
+
+/*
+ * #%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.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public abstract class AbstractTuttiTableUIModel<E, R extends AbstractTuttiBeanUIModel, B extends AbstractTuttiTableUIModel<E, R, B>> extends AbstractTuttiBeanUIModel<E, B> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_ROWS = "rows";
+
+ protected List<R> rows;
+
+ protected AbstractTuttiTableUIModel(Class<E> entityType, Binder<E, B> fromBeanBinder, Binder<B, E> toBeanBinder) {
+ super(entityType, fromBeanBinder, toBeanBinder);
+ }
+
+ public List<R> getRows() {
+ return rows;
+ }
+
+ public void setRows(List<R> rows) {
+ Object oldValue = getRows();
+ if (rows == null) {
+ rows = Lists.newArrayList();
+ }
+ this.rows = rows;
+ firePropertyChange(PROPERTY_ROWS, oldValue, rows);
+ }
+
+ public int getRowCount() {
+ return rows == null ? 0 : rows.size();
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,102 @@
+package fr.ifremer.tutti.ui.swing.util.table;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
+/**
+ * Action to select next editable cell in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MoveToNextEditableCellAction<M extends AbstractTuttiTableModel> extends AbstractSelectTableAction<M> {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MoveToNextEditableCellAction.class);
+
+ public static <M extends AbstractTuttiTableModel> MoveToNextEditableCellAction<M> newAction(M model, JTable table) {
+ return new MoveToNextEditableCellAction<M>(model, table);
+ }
+
+ protected MoveToNextEditableCellAction(M model, JTable table) {
+ super(model, table);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ int currentRow = getSelectedRow();
+ int currentColumn = getSelectedColumn();
+
+ if (log.isDebugEnabled()) {
+ log.debug("Move to previous editable cell " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+
+ int columnCount = getColumnCount();
+
+ int rowCount = getRowCount();
+
+ while (currentRow <= rowCount || currentColumn <= columnCount) {
+
+ // go to next cell
+ currentColumn++;
+
+ // select next cell
+ if (currentColumn >= columnCount) {
+
+ // no more cell, so will move to next editable column on next row
+ currentColumn = 0;
+ currentRow++;
+
+ if (currentRow == rowCount) {
+
+ // create a new row in model
+ addNewRow();
+ }
+ }
+
+ if (isCellEditable(currentRow, currentColumn)) {
+
+ doSelectCell(currentRow, currentColumn);
+
+ break;
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cell not editable at " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.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/util/table/MoveToNextEditableRowAction.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableRowAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableRowAction.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,85 @@
+package fr.ifremer.tutti.ui.swing.util.table;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
+/**
+ * Action to select next editable row in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MoveToNextEditableRowAction<M extends AbstractTuttiTableModel> extends AbstractSelectTableAction<M> {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MoveToNextEditableRowAction.class);
+
+ public static <M extends AbstractTuttiTableModel> MoveToNextEditableRowAction<M> newAction(M model, JTable table) {
+ return new MoveToNextEditableRowAction<M>(model, table);
+ }
+
+ protected MoveToNextEditableRowAction(M model, JTable table) {
+ super(model, table);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ int currentRow = getSelectedRow();
+ int currentColumn = getSelectedColumn();
+
+ if (isCellEditable(currentRow, currentColumn)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Move to next row editable cell " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ currentRow++;
+
+ if (currentRow >= getRowCount()) {
+ if (log.isDebugEnabled()) {
+ log.debug("No next row");
+ }
+
+ // create a new row in model
+ addNewRow();
+ }
+
+ doSelectCell(currentRow, currentColumn);
+
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cell not editable at " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ }
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableRowAction.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/util/table/MoveToPreviousEditableCellAction.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableCellAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableCellAction.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,90 @@
+package fr.ifremer.tutti.ui.swing.util.table;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
+/**
+ * Action to select previous editable cell in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MoveToPreviousEditableCellAction<M extends AbstractTuttiTableModel> extends AbstractSelectTableAction<M> {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MoveToPreviousEditableCellAction.class);
+
+ public static <M extends AbstractTuttiTableModel> MoveToPreviousEditableCellAction<M> newAction(M model, JTable table) {
+ return new MoveToPreviousEditableCellAction<M>(model, table);
+ }
+
+ protected MoveToPreviousEditableCellAction(M model, JTable table) {
+ super(model, table);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ int currentRow = getSelectedRow();
+ int currentColumn = getSelectedColumn();
+
+ if (log.isDebugEnabled()) {
+ log.debug("Move to previous editable cell, " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+
+ int columnCount = getColumnCount();
+
+ while (currentRow > 0 || currentColumn > 0) {
+
+ // go to next cell
+ currentColumn--;
+
+ // select next cell
+ if (currentColumn < 0) {
+
+ currentColumn = columnCount - 1;
+ currentRow--;
+ }
+
+ if (isCellEditable(currentRow, currentColumn)) {
+ doSelectCell(currentRow, currentColumn);
+ break;
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cell not editable at " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableCellAction.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/util/table/MoveToPreviousEditableRowAction.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableRowAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableRowAction.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,82 @@
+package fr.ifremer.tutti.ui.swing.util.table;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
+/**
+ * Action to select previous editable row in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MoveToPreviousEditableRowAction<M extends AbstractTuttiTableModel> extends AbstractSelectTableAction<M> {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MoveToPreviousEditableRowAction.class);
+
+ public static <M extends AbstractTuttiTableModel> MoveToPreviousEditableRowAction<M> newAction(M model, JTable table) {
+ return new MoveToPreviousEditableRowAction<M>(model, table);
+ }
+
+ protected MoveToPreviousEditableRowAction(M model, JTable table) {
+ super(model, table);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ int currentRow = getSelectedRow();
+ int currentColumn = getSelectedColumn();
+
+ if (isCellEditable(currentRow, currentColumn)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Move to previous row editable cell " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ currentRow--;
+
+ if (currentRow < 0) {
+ if (log.isDebugEnabled()) {
+ log.debug("No previous row");
+ }
+ } else {
+ doSelectCell(currentRow, currentColumn);
+ }
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cell not editable at " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ }
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableRowAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java 2012-12-06 17:03:05 UTC (rev 30)
@@ -0,0 +1,85 @@
+package fr.ifremer.tutti.ui.swing.util.table;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.beans.BeanMonitor;
+
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public abstract class TableRowModificationListener implements ListSelectionListener {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(TableRowModificationListener.class);
+
+ private final AbstractTuttiTableModel tableModel;
+
+ private final BeanMonitor beanMonitor;
+
+ protected abstract void saveSelectedRow();
+
+ public TableRowModificationListener(AbstractTuttiTableModel tableModel,
+ BeanMonitor beanMonitor) {
+ this.tableModel = tableModel;
+ this.beanMonitor = beanMonitor;
+ }
+
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
+ if (!e.getValueIsAdjusting()) {
+ ListSelectionModel source = (ListSelectionModel) e.getSource();
+ int selectedRow = source.getLeadSelectionIndex();
+
+ // save selected entry if required
+ saveSelectedRow();
+
+ if (log.isInfoEnabled()) {
+ log.info("New selected row: " + selectedRow);
+ }
+
+ Object entry;
+
+ if (selectedRow == -1) {
+ // no selection
+ entry = null;
+ } else {
+ entry = tableModel.getEntry(selectedRow);
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("Will monitor entry: " + entry);
+ }
+ beanMonitor.setBean(entry);
+ }
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-04 23:32:56 UTC (rev 29)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-06 17:03:05 UTC (rev 30)
@@ -51,6 +51,7 @@
tutti.label.fishes.totalHorsVracWeight=Poids total hors vrac
tutti.label.fishes.totalVracWeight=Poids total vrac
tutti.label.fishes.totalWeight=Poids total
+tutti.label.frequencyConfiguration=
tutti.label.list.gear=Engin(s)
tutti.label.list.headOfMission=Chef(s) de mission
tutti.label.list.headOfSortRoom=Reponsable(s) de salle de tri
@@ -120,6 +121,12 @@
tutti.menu.synchronisationImport.tip=Effectuer des imports
tutti.menu.synchronisations=Synchronisation
tutti.menu.synchronisations.tip=Import/Export
+tutti.speciesFrequency.configurationMode.autoGenerate=
+tutti.speciesFrequency.configurationMode.autoGenerate.tip=
+tutti.speciesFrequency.configurationMode.rafale=
+tutti.speciesFrequency.configurationMode.rafale.tip=
+tutti.speciesFrequency.configurationMode.simple=
+tutti.speciesFrequency.configurationMode.simple.tip=
tutti.table.benthos.header.number=Nombre observé
tutti.table.benthos.header.speciesByCode=Espèce
tutti.table.benthos.header.weight=Poids observé
@@ -132,21 +139,25 @@
tutti.table.plancton.header.number=Nombre observé
tutti.table.plancton.header.speciesByCode=Espèce
tutti.table.plancton.header.weight=Poids observé
-tutti.table.species.header.age=Age
-tutti.table.species.header.comment=Commentaire
-tutti.table.species.header.computedNumber=Nombre calculé
-tutti.table.species.header.computedWeight=Poids calculé
-tutti.table.species.header.elevationRate=Fraction d'él
-tutti.table.species.header.file=Pièces jointes
-tutti.table.species.header.maturity=Maturité
-tutti.table.species.header.sampleWeight=Poids échan
-tutti.table.species.header.sex=Sexe
-tutti.table.species.header.speciesByCode=Espèce
-tutti.table.species.header.speciesByGenusCode=Espèce
-tutti.table.species.header.toConfirm=A Confirmer
-tutti.table.species.header.vracHorsVrac=Vrac / Hors Vrac
-tutti.table.species.header.weight=Poids
-tutti.table.species.header.weightCategory=Catégorie Poids
+tutti.table.species.batch.header.age=Age
+tutti.table.species.batch.header.comment=Commentaire
+tutti.table.species.batch.header.computedNumber=Nombre calculé
+tutti.table.species.batch.header.computedWeight=Poids calculé
+tutti.table.species.batch.header.elevationRate=Fraction d'él
+tutti.table.species.batch.header.file=Pièces jointes
+tutti.table.species.batch.header.maturity=Maturité
+tutti.table.species.batch.header.sampleWeight=Poids échan
+tutti.table.species.batch.header.sex=Sexe
+tutti.table.species.batch.header.speciesByCode=Espèce
+tutti.table.species.batch.header.speciesByGenusCode=Espèce
+tutti.table.species.batch.header.toConfirm=A Confirmer
+tutti.table.species.batch.header.vracHorsVrac=Vrac / Hors Vrac
+tutti.table.species.batch.header.weight=Poids
+tutti.table.species.batch.header.weightCategory=Catégorie Poids
+tutti.table.species.frequency.header.computedWeight=Poids calculé
+tutti.table.species.frequency.header.lengthStep=Classe de taille
+tutti.table.species.frequency.header.number=Nombre
+tutti.table.species.frequency.header.weight=Poids observé
tutti.title.about=À propos de Tutti
tutti.title.create.campaign=Créer une nouvelle campagne
tutti.title.create.survey=Créer une nouvelle série de campagne
Added: trunk/tutti-ui-swing/src/main/resources/icons/action-show-frequency.png
===================================================================
(Binary files differ)
Property changes on: trunk/tutti-ui-swing/src/main/resources/icons/action-show-frequency.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: svn:keywords
+ Author Date Id Revision HeadURL
1
0
04 Dec '12
Author: tchemit
Date: 2012-12-05 00:32:56 +0100 (Wed, 05 Dec 2012)
New Revision: 29
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/29
Log:
introduce a package for each trait catches
save trait species specific fields
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java
Modified:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -119,7 +119,14 @@
protected Float averageBottomSalinity;
+ protected Float speciesTotalWeight;
+ protected Float speciesTotalVracWeight;
+
+ protected Float speciesSampleVracWeight;
+
+ protected Float speciesTotalHorsVracWeight;
+
public CampaignBean getCampaign() {
return campaign;
}
@@ -431,4 +438,36 @@
public void setAverageBottomSalinity(Float averageBottomSalinity) {
this.averageBottomSalinity = averageBottomSalinity;
}
+
+ public Float getSpeciesTotalWeight() {
+ return speciesTotalWeight;
+ }
+
+ public void setSpeciesTotalWeight(Float speciesTotalWeight) {
+ this.speciesTotalWeight = speciesTotalWeight;
+ }
+
+ public Float getSpeciesTotalVracWeight() {
+ return speciesTotalVracWeight;
+ }
+
+ public void setSpeciesTotalVracWeight(Float speciesTotalVracWeight) {
+ this.speciesTotalVracWeight = speciesTotalVracWeight;
+ }
+
+ public Float getSpeciesSampleVracWeight() {
+ return speciesSampleVracWeight;
+ }
+
+ public void setSpeciesSampleVracWeight(Float speciesSampleVracWeight) {
+ this.speciesSampleVracWeight = speciesSampleVracWeight;
+ }
+
+ public Float getSpeciesTotalHorsVracWeight() {
+ return speciesTotalHorsVracWeight;
+ }
+
+ public void setSpeciesTotalHorsVracWeight(Float speciesTotalHorsVracWeight) {
+ this.speciesTotalHorsVracWeight = speciesTotalHorsVracWeight;
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -26,6 +26,7 @@
import fr.ifremer.tutti.persistence.entities.CampaignBean;
import fr.ifremer.tutti.persistence.entities.SurveyBean;
+import fr.ifremer.tutti.persistence.entities.TuttiBeans;
import fr.ifremer.tutti.persistence.entities.referential.UserBean;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
@@ -137,7 +138,7 @@
CampaignBean bean = model.toBean();
CampaignBean saved;
- if (model.isCreate()) {
+ if (TuttiBeans.isNew(bean)) {
saved = persistenceService.createCampaign(bean);
} else {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -25,6 +25,7 @@
*/
import fr.ifremer.tutti.persistence.entities.SurveyBean;
+import fr.ifremer.tutti.persistence.entities.TuttiBeans;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.TuttiScreen;
@@ -120,7 +121,7 @@
SurveyBean bean = model.toBean();
SurveyBean saved;
- if (model.isCreate()) {
+ if (TuttiBeans.isNew(bean)) {
saved = persistenceService.createSurvey(bean);
} else {
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,59 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightLabel {
- text:"tutti.label.benthos.totalWeight";
- labelFor:{totalWeightField};
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleTotalWeightLabel {
- text:"tutti.label.benthos.sampleTotalWeight";
- labelFor:{totalWeightField};
-}
-
-#sampleTotalWeightField {
- property:"sampleTotalWeight";
- model:{model.getSampleTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,100 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<JPanel id='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<BenthosTabUIModel, BenthosTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
- fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public BenthosTabUI(CatchesUI parentUI) {
- BenthosTabUIHandler handler = new BenthosTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <BenthosTabUIHandler id='handler'
- initializer='getContextValue(BenthosTabUIHandler.class)'/>
-
- <BenthosTabUIModel id='model'
- initializer='getContextValue(BenthosTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,181 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BenthosTabUIHandler extends AbstractTuttiUIHandler<BenthosTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(BenthosTabUIHandler.class);
-
- private final BenthosTabUI ui;
-
- private final CatchesUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public BenthosTabUIHandler(CatchesUI parentUi, BenthosTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- BenthosTabUIModel model = new BenthosTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // species (by code) column
-
- col = new TableColumn(0);
-
- JComboBox speciesEditor = new JComboBox();
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
-// col.setCellEditor();
- col.setCellRenderer(newTableCellRender(SpeciesBean.class));
- col.setHeaderValue(_("tutti.table.benthos.header.speciesByCode"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("speciesByCode");
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(1);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.benthos.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weight");
- columnModel.addColumn(col);
-
- // Nombre observé
- col = new TableColumn(2);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.benthos.header.number"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedNumber");
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final BenthosTableModel tableModel = new BenthosTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(BenthosTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
- }
- });
-
- }
-
- @Override
- public void afterInitUI() {
- BenthosTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected BenthosTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectTrait(TraitBean bean) {
-
- boolean empty = bean == null;
-
- BenthosTabUIModel model = ui.getModel();
-
- List<TraitBenthosCatchBean> catches;
-
- if (empty) {
- catches = null;
- bean = new TraitBean();
- } else {
- catches = persistenceService.getAllTraitBenthosCatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BenthosTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float sampleTotalWeight;
-
- protected List<TraitBenthosCatchBean> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- public List<TraitBenthosCatchBean> getCatches() {
- return catches;
- }
-
- public void setCatches(List<TraitBenthosCatchBean> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- BenthosTabUIModel.class).copy(bean, this);
- }
-
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(BenthosTabUIModel.class,
- TraitBean.class).copy(this, result);
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BenthosTableModel extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- protected List<TraitSpeciesCatchBean> data;
-
- protected final TableColumnModel columnModel;
-
- public BenthosTableModel(TableColumnModel columnModel) {
- this.columnModel = columnModel;
- }
-
- public void setData(List<TraitSpeciesCatchBean> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return data == null ? 0 : data.size();
- }
-
- @Override
- public int getColumnCount() {
- return columnModel.getColumnCount();
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- return null;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,59 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightLabel {
- text:"tutti.label.captureAccidentel.totalWeight";
- labelFor:{totalWeightField};
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleTotalWeightLabel {
- text:"tutti.label.captureAccidentel.sampleTotalWeight";
- labelFor:{totalWeightField};
-}
-
-#sampleTotalWeightField {
- property:"sampleTotalWeight";
- model:{model.getSampleTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,100 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<JPanel id='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<CaptureAccidentelTabUIModel, CaptureAccidentelTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
- fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public CaptureAccidentelTabUI(CatchesUI parentUI) {
- CaptureAccidentelTabUIHandler handler = new CaptureAccidentelTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <CaptureAccidentelTabUIHandler id='handler'
- initializer='getContextValue(CaptureAccidentelTabUIHandler.class)'/>
-
- <CaptureAccidentelTabUIModel id='model'
- initializer='getContextValue(CaptureAccidentelTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,181 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class CaptureAccidentelTabUIHandler extends AbstractTuttiUIHandler<CaptureAccidentelTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(CaptureAccidentelTabUIHandler.class);
-
- private final CaptureAccidentelTabUI ui;
-
- private final CatchesUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public CaptureAccidentelTabUIHandler(CatchesUI parentUi, CaptureAccidentelTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- CaptureAccidentelTabUIModel model = new CaptureAccidentelTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // species (by code) column
-
- col = new TableColumn(0);
-
- JComboBox speciesEditor = new JComboBox();
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
-// col.setCellEditor();
- col.setCellRenderer(newTableCellRender(SpeciesBean.class));
- col.setHeaderValue(_("tutti.table.captureAccidentel.header.speciesByCode"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("speciesByCode");
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(1);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.captureAccidentel.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weight");
- columnModel.addColumn(col);
-
- // Nombre observé
- col = new TableColumn(2);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.captureAccidentel.header.number"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedNumber");
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final CaptureAccidentelTableModel tableModel = new CaptureAccidentelTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(CaptureAccidentelTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
- }
- });
-
- }
-
- @Override
- public void afterInitUI() {
- CaptureAccidentelTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected CaptureAccidentelTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectTrait(TraitBean bean) {
-
- boolean empty = bean == null;
-
- CaptureAccidentelTabUIModel model = ui.getModel();
-
- List<TraitCaptureAccidentelCatchBean> catches;
-
- if (empty) {
- catches = null;
- bean = new TraitBean();
- } else {
- catches = persistenceService.getAllTraitCaptureAccidentelCatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class CaptureAccidentelTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float sampleTotalWeight;
-
- protected List<TraitCaptureAccidentelCatchBean> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- public List<TraitCaptureAccidentelCatchBean> getCatches() {
- return catches;
- }
-
- public void setCatches(List<TraitCaptureAccidentelCatchBean> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- CaptureAccidentelTabUIModel.class).copy(bean, this);
- }
-
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(CaptureAccidentelTabUIModel.class,
- TraitBean.class).copy(this, result);
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class CaptureAccidentelTableModel extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- protected List<TraitSpeciesCatchBean> data;
-
- protected final TableColumnModel columnModel;
-
- public CaptureAccidentelTableModel(TableColumnModel columnModel) {
- this.columnModel = columnModel;
- }
-
- public void setData(List<TraitSpeciesCatchBean> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return data == null ? 0 : data.size();
- }
-
- @Override
- public int getColumnCount() {
- return columnModel.getColumnCount();
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- return null;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -54,7 +54,7 @@
enabled:{model.getSelectedTrait() != null};
}
-#captureAccidentelTab {
+#accidentelTab {
enabled:{model.getSelectedTrait() != null};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -28,6 +28,10 @@
fr.ifremer.tutti.persistence.entities.TraitBean
fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.accidentel.AccidentelTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.benthos.BenthosTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.macrodechet.MacroDechetTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.plancton.PlanctonTabUI
fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTabUI
jaxx.runtime.swing.editor.bean.BeanComboBox
@@ -84,8 +88,8 @@
<tab id='macroDechetTab' title='tutti.label.tab.macroDechet'>
<MacroDechetTabUI id='macroDechetTabContent' constructorParams='this'/>
</tab>
- <tab id='captureAccidentelTab' title='tutti.label.tab.captureAccidentel'>
- <CaptureAccidentelTabUI id='captureAccidentelTabContent' constructorParams='this'/>
+ <tab id='accidentelTab' title='tutti.label.tab.accidentel'>
+ <AccidentelTabUI id='accidentelTabContent' constructorParams='this'/>
</tab>
<tab id='observationIndividuelTab' title='tutti.label.tab.observationIndividuel'>
<JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -120,6 +120,9 @@
// ui will be saved so we do not want to keep selected tab indexes
ui.getTabPane().setSelectedIndex(0);
ui.getTraitTabContent().getTraitTabPane().setSelectedIndex(0);
+
+ // when quitting ui, let's de-select trait (will save any changes)
+ selectTrait(null);
}
@Override
@@ -156,7 +159,7 @@
ui.getBenthosTabContent().selectTrait(selectedTrait);
ui.getPlanctonTabContent().selectTrait(selectedTrait);
ui.getMacroDechetTabContent().selectTrait(selectedTrait);
- ui.getCaptureAccidentelTabContent().selectTrait(selectedTrait);
+ ui.getAccidentelTabContent().selectTrait(selectedTrait);
// repaint tabs
ui.getTabPane().repaint();
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,59 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightLabel {
- text:"tutti.label.macroDechet.totalWeight";
- labelFor:{totalWeightField};
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleTotalWeightLabel {
- text:"tutti.label.macroDechet.sampleTotalWeight";
- labelFor:{totalWeightField};
-}
-
-#sampleTotalWeightField {
- property:"sampleTotalWeight";
- model:{model.getSampleTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,100 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<JPanel id='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<MacroDechetTabUIModel, MacroDechetTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
- fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public MacroDechetTabUI(CatchesUI parentUI) {
- MacroDechetTabUIHandler handler = new MacroDechetTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <MacroDechetTabUIHandler id='handler'
- initializer='getContextValue(MacroDechetTabUIHandler.class)'/>
-
- <MacroDechetTabUIModel id='model'
- initializer='getContextValue(MacroDechetTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,181 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MacroDechetTabUIHandler extends AbstractTuttiUIHandler<MacroDechetTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(MacroDechetTabUIHandler.class);
-
- private final MacroDechetTabUI ui;
-
- private final CatchesUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public MacroDechetTabUIHandler(CatchesUI parentUi, MacroDechetTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- MacroDechetTabUIModel model = new MacroDechetTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // species (by code) column
-
- col = new TableColumn(0);
-
- JComboBox speciesEditor = new JComboBox();
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
-// col.setCellEditor();
- col.setCellRenderer(newTableCellRender(SpeciesBean.class));
- col.setHeaderValue(_("tutti.table.macroDechet.header.speciesByCode"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("speciesByCode");
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(1);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.macroDechet.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weight");
- columnModel.addColumn(col);
-
- // Nombre observé
- col = new TableColumn(2);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.macroDechet.header.number"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedNumber");
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final MacroDechetTableModel tableModel = new MacroDechetTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(MacroDechetTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
- }
- });
-
- }
-
- @Override
- public void afterInitUI() {
- MacroDechetTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected MacroDechetTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectTrait(TraitBean bean) {
-
- boolean empty = bean == null;
-
- MacroDechetTabUIModel model = ui.getModel();
-
- List<TraitMacroDechetCatchBean> catches;
-
- if (empty) {
- catches = null;
- bean = new TraitBean();
- } else {
- catches = persistenceService.getAllTraitMacroDechetCatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MacroDechetTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float sampleTotalWeight;
-
- protected List<TraitMacroDechetCatchBean> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- public List<TraitMacroDechetCatchBean> getCatches() {
- return catches;
- }
-
- public void setCatches(List<TraitMacroDechetCatchBean> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- MacroDechetTabUIModel.class).copy(bean, this);
- }
-
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(MacroDechetTabUIModel.class,
- TraitBean.class).copy(this, result);
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MacroDechetTableModel extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- protected List<TraitSpeciesCatchBean> data;
-
- protected final TableColumnModel columnModel;
-
- public MacroDechetTableModel(TableColumnModel columnModel) {
- this.columnModel = columnModel;
- }
-
- public void setData(List<TraitSpeciesCatchBean> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return data == null ? 0 : data.size();
- }
-
- @Override
- public int getColumnCount() {
- return columnModel.getColumnCount();
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- return null;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,59 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightLabel {
- text:"tutti.label.plancton.totalWeight";
- labelFor:{totalWeightField};
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleTotalWeightLabel {
- text:"tutti.label.plancton.sampleTotalWeight";
- labelFor:{totalWeightField};
-}
-
-#sampleTotalWeightField {
- property:"sampleTotalWeight";
- model:{model.getSampleTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,100 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<JPanel id='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<PlanctonTabUIModel, PlanctonTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
- fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public PlanctonTabUI(CatchesUI parentUI) {
- PlanctonTabUIHandler handler = new PlanctonTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <PlanctonTabUIHandler id='handler'
- initializer='getContextValue(PlanctonTabUIHandler.class)'/>
-
- <PlanctonTabUIModel id='model'
- initializer='getContextValue(PlanctonTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,181 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class PlanctonTabUIHandler extends AbstractTuttiUIHandler<PlanctonTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(PlanctonTabUIHandler.class);
-
- private final PlanctonTabUI ui;
-
- private final CatchesUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public PlanctonTabUIHandler(CatchesUI parentUi, PlanctonTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- PlanctonTabUIModel model = new PlanctonTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // species (by code) column
-
- col = new TableColumn(0);
-
- JComboBox speciesEditor = new JComboBox();
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
-// col.setCellEditor();
- col.setCellRenderer(newTableCellRender(SpeciesBean.class));
- col.setHeaderValue(_("tutti.table.plancton.header.speciesByCode"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("speciesByCode");
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(1);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.plancton.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weight");
- columnModel.addColumn(col);
-
- // Nombre observé
- col = new TableColumn(2);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.plancton.header.number"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedNumber");
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final PlanctonTableModel tableModel = new PlanctonTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(PlanctonTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
- }
- });
-
- }
-
- @Override
- public void afterInitUI() {
- PlanctonTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected PlanctonTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectTrait(TraitBean bean) {
-
- boolean empty = bean == null;
-
- PlanctonTabUIModel model = ui.getModel();
-
- List<TraitPlanctonCatchBean> catches;
-
- if (empty) {
- catches = null;
- bean = new TraitBean();
- } else {
- catches = persistenceService.getAllTraitPlanctonCatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class PlanctonTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float sampleTotalWeight;
-
- protected List<TraitPlanctonCatchBean> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- public List<TraitPlanctonCatchBean> getCatches() {
- return catches;
- }
-
- public void setCatches(List<TraitPlanctonCatchBean> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- PlanctonTabUIModel.class).copy(bean, this);
- }
-
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(PlanctonTabUIModel.class,
- TraitBean.class).copy(this, result);
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class PlanctonTableModel extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- protected List<TraitSpeciesCatchBean> data;
-
- protected final TableColumnModel columnModel;
-
- public PlanctonTableModel(TableColumnModel columnModel) {
- this.columnModel = columnModel;
- }
-
- public void setData(List<TraitSpeciesCatchBean> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return data == null ? 0 : data.size();
- }
-
- @Override
- public int getColumnCount() {
- return columnModel.getColumnCount();
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- return null;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-}
\ No newline at end of file
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.captureAccidentel.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.captureAccidentel.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,98 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<AccidentelTabUIModel, AccidentelTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.TraitBean
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public AccidentelTabUI(CatchesUI parentUI) {
+ AccidentelTabUIHandler handler = new AccidentelTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <AccidentelTabUIHandler id='handler'
+ initializer='getContextValue(AccidentelTabUIHandler.class)'/>
+
+ <AccidentelTabUIModel id='model'
+ initializer='getContextValue(AccidentelTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.catches.accidentel;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentelTabUIHandler extends AbstractTuttiUIHandler<AccidentelTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(AccidentelTabUIHandler.class);
+
+ private final AccidentelTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public AccidentelTabUIHandler(CatchesUI parentUi, AccidentelTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ AccidentelTabUIModel model = new AccidentelTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+ col.setHeaderValue(_("tutti.table.captureAccidentel.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.captureAccidentel.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.captureAccidentel.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final AccidentelTableModel tableModel = new AccidentelTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(AccidentelTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ AccidentelTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected AccidentelTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ boolean empty = bean == null;
+
+ AccidentelTabUIModel model = ui.getModel();
+
+ List<TraitCaptureAccidentelCatchBean> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new TraitBean();
+ } else {
+ catches = persistenceService.getAllTraitCaptureAccidentelCatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.catches.accidentel;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentelTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<TraitCaptureAccidentelCatchBean> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<TraitCaptureAccidentelCatchBean> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<TraitCaptureAccidentelCatchBean> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ AccidentelTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(AccidentelTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.catches.accidentel;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentelTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<TraitSpeciesCatchBean> data;
+
+ protected final TableColumnModel columnModel;
+
+ public AccidentelTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<TraitSpeciesCatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new TraitSpeciesCatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.css (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.benthos.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.benthos.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,98 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<BenthosTabUIModel, BenthosTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.TraitBean
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public BenthosTabUI(CatchesUI parentUI) {
+ BenthosTabUIHandler handler = new BenthosTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <BenthosTabUIHandler id='handler'
+ initializer='getContextValue(BenthosTabUIHandler.class)'/>
+
+ <BenthosTabUIModel id='model'
+ initializer='getContextValue(BenthosTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.catches.benthos;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosTabUIHandler extends AbstractTuttiUIHandler<BenthosTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(BenthosTabUIHandler.class);
+
+ private final BenthosTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public BenthosTabUIHandler(CatchesUI parentUi, BenthosTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ BenthosTabUIModel model = new BenthosTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+ col.setHeaderValue(_("tutti.table.benthos.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.benthos.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.benthos.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final BenthosTableModel tableModel = new BenthosTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(BenthosTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ BenthosTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected BenthosTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ boolean empty = bean == null;
+
+ BenthosTabUIModel model = ui.getModel();
+
+ List<TraitBenthosCatchBean> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new TraitBean();
+ } else {
+ catches = persistenceService.getAllTraitBenthosCatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.catches.benthos;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<TraitBenthosCatchBean> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<TraitBenthosCatchBean> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<TraitBenthosCatchBean> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ BenthosTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(BenthosTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.catches.benthos;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<TraitSpeciesCatchBean> data;
+
+ protected final TableColumnModel columnModel;
+
+ public BenthosTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<TraitSpeciesCatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new TraitSpeciesCatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.css (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.macroDechet.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.macroDechet.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,98 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<MacroDechetTabUIModel, MacroDechetTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.TraitBean
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public MacroDechetTabUI(CatchesUI parentUI) {
+ MacroDechetTabUIHandler handler = new MacroDechetTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <MacroDechetTabUIHandler id='handler'
+ initializer='getContextValue(MacroDechetTabUIHandler.class)'/>
+
+ <MacroDechetTabUIModel id='model'
+ initializer='getContextValue(MacroDechetTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.catches.macrodechet;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroDechetTabUIHandler extends AbstractTuttiUIHandler<MacroDechetTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(MacroDechetTabUIHandler.class);
+
+ private final MacroDechetTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public MacroDechetTabUIHandler(CatchesUI parentUi, MacroDechetTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ MacroDechetTabUIModel model = new MacroDechetTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+ col.setHeaderValue(_("tutti.table.macroDechet.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.macroDechet.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.macroDechet.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final MacroDechetTableModel tableModel = new MacroDechetTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(MacroDechetTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ MacroDechetTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected MacroDechetTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ boolean empty = bean == null;
+
+ MacroDechetTabUIModel model = ui.getModel();
+
+ List<TraitMacroDechetCatchBean> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new TraitBean();
+ } else {
+ catches = persistenceService.getAllTraitMacroDechetCatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.catches.macrodechet;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroDechetTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<TraitMacroDechetCatchBean> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<TraitMacroDechetCatchBean> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<TraitMacroDechetCatchBean> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ MacroDechetTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(MacroDechetTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.catches.macrodechet;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroDechetTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<TraitSpeciesCatchBean> data;
+
+ protected final TableColumnModel columnModel;
+
+ public MacroDechetTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<TraitSpeciesCatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new TraitSpeciesCatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.css (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.plancton.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.plancton.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,98 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<PlanctonTabUIModel, PlanctonTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.TraitBean
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public PlanctonTabUI(CatchesUI parentUI) {
+ PlanctonTabUIHandler handler = new PlanctonTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <PlanctonTabUIHandler id='handler'
+ initializer='getContextValue(PlanctonTabUIHandler.class)'/>
+
+ <PlanctonTabUIModel id='model'
+ initializer='getContextValue(PlanctonTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.catches.plancton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanctonTabUIHandler extends AbstractTuttiUIHandler<PlanctonTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(PlanctonTabUIHandler.class);
+
+ private final PlanctonTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public PlanctonTabUIHandler(CatchesUI parentUi, PlanctonTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ PlanctonTabUIModel model = new PlanctonTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+ col.setHeaderValue(_("tutti.table.plancton.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.plancton.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.plancton.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final PlanctonTableModel tableModel = new PlanctonTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(PlanctonTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ PlanctonTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected PlanctonTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ boolean empty = bean == null;
+
+ PlanctonTabUIModel model = ui.getModel();
+
+ List<TraitPlanctonCatchBean> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new TraitBean();
+ } else {
+ catches = persistenceService.getAllTraitPlanctonCatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.catches.plancton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanctonTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<TraitPlanctonCatchBean> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<TraitPlanctonCatchBean> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<TraitPlanctonCatchBean> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ PlanctonTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(PlanctonTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.catches.plancton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanctonTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<TraitSpeciesCatchBean> data;
+
+ protected final TableColumnModel columnModel;
+
+ public PlanctonTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<TraitSpeciesCatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new TraitSpeciesCatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -24,7 +24,6 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.TraitBean;
import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
import fr.ifremer.tutti.persistence.entities.VracHorsVracEnum;
import fr.ifremer.tutti.persistence.entities.referential.SexBean;
@@ -66,13 +65,6 @@
public static final String PROPERTY_COMMENT = "comment";
/**
- * When catch was observed.
- *
- * @since 0.2
- */
- protected TraitBean trait;
-
- /**
* Species observed.
*
* @since 0.2
@@ -149,14 +141,6 @@
*/
protected String comment;
- public TraitBean getTrait() {
- return trait;
- }
-
- public void setTrait(TraitBean trait) {
- this.trait = trait;
- }
-
public SpeciesBean getSpecies() {
return species;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -25,11 +25,8 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesTabUIModel, SpeciesTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
+
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
@@ -41,8 +38,6 @@
jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
javax.swing.ListSelectionModel
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
java.awt.Color
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -90,14 +90,16 @@
private final PersistenceService persistenceService;
- private final BeanMonitor monitor;
+ private final BeanMonitor rowMonitor;
+ private final BeanMonitor traitMonitor;
+
public SpeciesTabUIHandler(CatchesUI parentUi, SpeciesTabUI ui) {
super(parentUi.getHandler().getContext());
this.ui = ui;
this.parentUi = parentUi;
this.persistenceService = context.getService(PersistenceService.class);
- monitor = new BeanMonitor(
+ rowMonitor = new BeanMonitor(
SpeciesCatchEntryModel.PROPERTY_SPECIES,
SpeciesCatchEntryModel.PROPERTY_SPECIES_TO_CONFIRM,
SpeciesCatchEntryModel.PROPERTY_VRAC_HORS_VRAC,
@@ -109,6 +111,12 @@
SpeciesCatchEntryModel.PROPERTY_SAMPLE_WEIGHT,
SpeciesCatchEntryModel.PROPERTY_ELEVATION_RATIO,
SpeciesCatchEntryModel.PROPERTY_COMMENT);
+ traitMonitor = new BeanMonitor(
+ SpeciesTabUIModel.PROPERTY_SAMPLE_VRAC_WEIGHT,
+ SpeciesTabUIModel.PROPERTY_TOTAL_HORS_VRAC_WEIGHT,
+ SpeciesTabUIModel.PROPERTY_TOTAL_VRAC_WEIGHT,
+ SpeciesTabUIModel.PROPERTY_TOTAL_WEIGHT
+ );
}
@Override
@@ -116,6 +124,8 @@
SpeciesTabUIModel model = new SpeciesTabUIModel();
ui.setContextValue(model);
+
+ traitMonitor.setBean(model);
}
@Override
@@ -170,13 +180,19 @@
log.info("New selected row: " + selectedRow);
}
- SpeciesCatchEntryModel entry =
- tableModel.getEntry(selectedRow);
+ SpeciesCatchEntryModel entry;
+ if (selectedRow == -1) {
+ // no selection
+ entry = null;
+ } else {
+ entry = tableModel.getEntry(selectedRow);
+ }
+
if (log.isInfoEnabled()) {
log.info("Will monitor entry: " + entry);
}
- monitor.setBean(entry);
+ rowMonitor.setBean(entry);
}
}
});
@@ -185,9 +201,15 @@
public void saveSelectedRowIfRequired(FocusEvent event) {
Component oppositeComponent = event.getOppositeComponent();
- JXTable parentContainer = SwingUtil.getParentContainer(
- oppositeComponent, JXTable.class);
+ JXTable parentContainer = null;
+ if (oppositeComponent != null) {
+
+ // check out if still on table
+ parentContainer = SwingUtil.getParentContainer(
+ oppositeComponent, JXTable.class);
+ }
+
if (parentContainer == null) {
// out of the table can save
@@ -197,12 +219,12 @@
public void saveSelectedRowIfRequired() {
- SpeciesCatchEntryModel bean = (SpeciesCatchEntryModel) monitor.getBean();
+ SpeciesCatchEntryModel bean = (SpeciesCatchEntryModel) rowMonitor.getBean();
if (bean != null) {
// there is a bean attached to the monitor
- if (monitor.wasModified()) {
+ if (rowMonitor.wasModified()) {
// monitored bean was modified, save it
if (log.isInfoEnabled()) {
@@ -211,8 +233,11 @@
TraitSpeciesCatchBean catchBean = bean.toBean();
- TraitBean trait = parentUi.getModel().getSelectedTrait();
+ TraitBean trait = getModel().getTrait();
catchBean.setTrait(trait);
+ if (log.isInfoEnabled()) {
+ log.info("Selected trait: " + trait.getId());
+ }
if (TuttiBeans.isNew(catchBean)) {
@@ -223,7 +248,7 @@
}
// clear modified flag on the monitor
- monitor.clearModified();
+ rowMonitor.clearModified();
}
}
}
@@ -234,58 +259,68 @@
public void selectTrait(TraitBean bean) {
+ if (traitMonitor.wasModified()) {
+
+ // previous trait was modified, let's save it
+ SpeciesTabUIModel traitMonitorBean =
+ (SpeciesTabUIModel) traitMonitor.getBean();
+
+ TraitBean traitBean = traitMonitorBean.toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("Trait " + traitBean.getId() +
+ " was modified, will save it.");
+ }
+
+ persistenceService.saveTrait(traitBean);
+ }
+
// make sure selection is empty (will remove bean from monitor)
ui.getTable().clearSelection();
boolean empty = bean == null;
- SpeciesTabUIModel model = ui.getModel();
+ SpeciesTabUIModel model = getModel();
List<SpeciesCatchEntryModel> rows;
if (empty) {
rows = null;
bean = new TraitBean();
+ model.setTrait(null);
} else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species catches for trait: " + bean.getId());
+ }
List<TraitSpeciesCatchBean> catches =
persistenceService.getAllTraitSpeciesCatch(bean.getId());
rows = Lists.newArrayList();
for (TraitSpeciesCatchBean aCatch : catches) {
SpeciesCatchEntryModel entry = new SpeciesCatchEntryModel();
- entry.setTrait(bean);
entry.fromBean(aCatch);
rows.add(entry);
}
+ model.setTrait(bean);
}
model.fromBean(bean);
- model.setCatches(rows);
+ model.setRows(rows);
+
//monitor.setBean(null);
rows = model.getRows();
- monitor.setBean(rows.get(0));
+ rowMonitor.setBean(rows.get(0));
+ traitMonitor.clearModified();
}
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
@Override
protected SpeciesTabUIModel getModel() {
return ui.getModel();
}
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-
protected TableColumnModel createTableColumnModel(JXTable table) {
KeyListener keyAdapter = createTableKeyListener(getModel(), table);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -30,7 +30,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderModelBuilder;
import java.util.List;
@@ -57,6 +58,8 @@
public static final String PROPERTY_NEW_ROW = "newRow";
+ protected TraitBean trait;
+
protected Float totalWeight;
protected Float totalVracWeight;
@@ -72,6 +75,28 @@
*/
protected List<SpeciesCatchEntryModel> rows;
+ protected final Binder<TraitBean, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(TraitBean.class, SpeciesTabUIModel.class)
+ .addProperty("speciesTotalWeight", PROPERTY_TOTAL_WEIGHT)
+ .addProperty("speciesTotalHorsVracWeight", PROPERTY_TOTAL_HORS_VRAC_WEIGHT)
+ .addProperty("speciesTotalVracWeight", PROPERTY_TOTAL_VRAC_WEIGHT)
+ .addProperty("speciesSampleVracWeight", PROPERTY_SAMPLE_VRAC_WEIGHT)
+ .toBinder();
+
+ protected final Binder<SpeciesTabUIModel, TraitBean> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesTabUIModel.class, TraitBean.class)
+ .addProperty(PROPERTY_TOTAL_WEIGHT, "speciesTotalWeight")
+ .addProperty(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, "speciesTotalHorsVracWeight")
+ .addProperty(PROPERTY_TOTAL_VRAC_WEIGHT, "speciesTotalVracWeight")
+ .addProperty(PROPERTY_SAMPLE_VRAC_WEIGHT, "speciesSampleVracWeight")
+ .toBinder();
+
+ public TraitBean getTrait() {
+ return trait;
+ }
+
+ public void setTrait(TraitBean trait) {
+ this.trait = trait;
+ }
+
public Float getTotalWeight() {
return totalWeight;
}
@@ -120,7 +145,7 @@
return rows;
}
- public void setCatches(List<SpeciesCatchEntryModel> rows) {
+ public void setRows(List<SpeciesCatchEntryModel> rows) {
Object oldValue = getRowCount();
if (rows == null) {
rows = Lists.newArrayList();
@@ -142,15 +167,17 @@
}
public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- SpeciesTabUIModel.class).copy(bean, this);
+
+ fromBeanBinder.copy(bean, this);
}
public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(SpeciesTabUIModel.class,
- TraitBean.class).copy(this, result);
+ TraitBean result = trait;
+ toBeanBinder.copy(this, result);
return result;
}
+ public String getId() {
+ return trait == null ? null : trait.getId();
+ }
}
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-04 23:32:56 UTC (rev 29)
@@ -64,8 +64,8 @@
tutti.label.survey=Série de campagne
tutti.label.survey.name=Nom
tutti.label.survey.zone=Zone
+tutti.label.tab.accidentel=Captures accidentelles
tutti.label.tab.benthos=Benthos
-tutti.label.tab.captureAccidentel=Captures accidentelles
tutti.label.tab.macroDechet=Macro déchets
tutti.label.tab.observationIndividuel=Observations individuelles
tutti.label.tab.plancton=Plancton
1
0
r28 - in trunk: tutti-service/src/main/java/fr/ifremer/tutti/service tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing
by tchemit@users.forge.codelutin.com 04 Dec '12
by tchemit@users.forge.codelutin.com 04 Dec '12
04 Dec '12
Author: tchemit
Date: 2012-12-05 00:31:44 +0100 (Wed, 05 Dec 2012)
New Revision: 28
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/28
Log:
fix service closes
Modified:
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java 2012-12-04 17:59:54 UTC (rev 27)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java 2012-12-04 23:31:44 UTC (rev 28)
@@ -88,20 +88,6 @@
}
}
- public <S extends TuttiService> void closeService(S service) throws IOException {
-
- services.invalidate(service.getClass());
-
- if (log.isInfoEnabled()) {
- log.info("Close service " + service);
- }
- service.close();
- }
-
- public void open() {
- //TODO
- }
-
@Override
public void close() throws IOException {
@@ -111,6 +97,6 @@
}
IOUtils.closeQuietly(service);
}
- services.cleanUp();
+ services.invalidateAll();
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-04 17:59:54 UTC (rev 27)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-04 23:31:44 UTC (rev 28)
@@ -185,8 +185,6 @@
public void open() {
- serviceContext.open();
-
if (surveyId == null) {
// load it from config
1
0
04 Dec '12
Author: tchemit
Date: 2012-12-04 18:59:54 +0100 (Tue, 04 Dec 2012)
New Revision: 27
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/27
Log:
introduce species package + save species catches batches
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java
Modified:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -107,6 +107,8 @@
TraitBean getTrait(String traitId);
+ TraitSpeciesCatchBean getTraitSpeciesCatch(String id);
+
SurveyBean createSurvey(SurveyBean bean);
SurveyBean saveSurvey(SurveyBean bean);
@@ -119,4 +121,8 @@
TraitBean saveTrait(TraitBean bean);
+ TraitSpeciesCatchBean createTraitSpeciesCatch(TraitSpeciesCatchBean bean);
+
+ TraitSpeciesCatchBean saveTraitSpeciesCatch(TraitSpeciesCatchBean bean);
+
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -34,7 +34,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class TraitSpeciesCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware{
+public class TraitSpeciesCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware {
private static final long serialVersionUID = 1L;
@@ -115,6 +115,13 @@
*/
protected Float elevationRatio;
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
public TraitBean getTrait() {
return trait;
}
@@ -139,14 +146,6 @@
this.speciesToConfirm = speciesToConfirm;
}
- public boolean isSpeciesToConfirm() {
- return speciesToConfirm;
- }
-
- public void setSpeciesToConfirm(boolean speciesToConfirm) {
- this.speciesToConfirm = speciesToConfirm;
- }
-
public VracHorsVracEnum getVracHorsVrac() {
return vracHorsVrac;
}
@@ -210,4 +209,12 @@
public void setElevationRatio(Float elevationRatio) {
this.elevationRatio = elevationRatio;
}
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -37,6 +37,10 @@
*/
public class TuttiBeans {
+ public static <B extends AbstractTuttiBean> boolean isNew(B bean) {
+ return bean.getId() == null;
+ }
+
public static <B extends AbstractTuttiBean> Predicate<B> newIdPredicate(String id) {
return new IdPredicate<B>(id);
}
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -277,6 +277,12 @@
}
@Override
+ public TraitSpeciesCatchBean getTraitSpeciesCatch(String id) {
+ TraitSpeciesCatchBean result = TuttiBeans.findById(getData(TraitSpeciesCatchBean.class), id);
+ return result;
+ }
+
+ @Override
public SurveyBean createSurvey(SurveyBean bean) {
SurveyBean result = new SurveyBean();
persist(SurveyBean.class, bean, result);
@@ -318,6 +324,20 @@
return result;
}
+ @Override
+ public TraitSpeciesCatchBean createTraitSpeciesCatch(TraitSpeciesCatchBean bean) {
+ TraitSpeciesCatchBean result = new TraitSpeciesCatchBean();
+ persist(TraitSpeciesCatchBean.class, bean, result);
+ return result;
+ }
+
+ @Override
+ public TraitSpeciesCatchBean saveTraitSpeciesCatch(TraitSpeciesCatchBean bean) {
+ TraitSpeciesCatchBean result = getTraitSpeciesCatch(bean.getId());
+ persist(TraitSpeciesCatchBean.class, bean, result);
+ return result;
+ }
+
protected <B extends AbstractTuttiBean> void persist(Class<B> beanType,
B source, B target) {
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -256,6 +256,12 @@
}
@Override
+ public TraitSpeciesCatchBean getTraitSpeciesCatch(String id) {
+ checkDriverExists();
+ return driver.getTraitSpeciesCatch(id);
+ }
+
+ @Override
public SurveyBean createSurvey(SurveyBean bean) {
checkDriverExists();
return driver.createSurvey(bean);
@@ -291,6 +297,18 @@
return driver.saveTrait(bean);
}
+ @Override
+ public TraitSpeciesCatchBean createTraitSpeciesCatch(TraitSpeciesCatchBean bean) {
+ checkDriverExists();
+ return driver.createTraitSpeciesCatch(bean);
+ }
+
+ @Override
+ public TraitSpeciesCatchBean saveTraitSpeciesCatch(TraitSpeciesCatchBean bean) {
+ checkDriverExists();
+ return driver.saveTraitSpeciesCatch(bean);
+ }
+
protected void checkDriverExists() {
Preconditions.checkNotNull(
driver,
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -270,6 +270,17 @@
jlist.setSelectedIndices(result);
}
+ protected <O> Decorator<O> getDecorator(Class<O> type, String name) {
+ DecoratorService decoratorService =
+ context.getService(DecoratorService.class);
+
+ Preconditions.checkNotNull(type);
+
+ Decorator<O> decorator = decoratorService.getDecoratorByType(type, name);
+ Preconditions.checkNotNull(decorator);
+ return decorator;
+ }
+
protected <O> ListCellRenderer newListCellRender(Class<O> type) {
return newListCellRender(type, null);
@@ -277,15 +288,15 @@
protected <O> ListCellRenderer newListCellRender(Class<O> type, String name) {
- DecoratorService decoratorService =
- context.getService(DecoratorService.class);
+ Decorator<O> decorator = getDecorator(type, name);
+ return newListCellRender(decorator);
+ }
- Preconditions.checkNotNull(type);
+ protected <O> ListCellRenderer newListCellRender(Decorator<O> decorator) {
- Decorator<O> decorator = decoratorService.getDecoratorByType(type, name);
Preconditions.checkNotNull(decorator);
- DecoratorListCellRenderer result = new DecoratorListCellRenderer(decorator);
+ ListCellRenderer result = new DecoratorListCellRenderer(decorator);
return result;
}
@@ -296,12 +307,14 @@
protected <O> TableCellRenderer newTableCellRender(Class<O> type, String name) {
- DecoratorService decoratorService =
- context.getService(DecoratorService.class);
+ Decorator<O> decorator = getDecorator(type, name);
- Preconditions.checkNotNull(type);
+ TableCellRenderer result = newTableCellRender(decorator);
+ return result;
+ }
- Decorator<O> decorator = decoratorService.getDecoratorByType(type, name);
+ protected <O> TableCellRenderer newTableCellRender(Decorator<O> decorator) {
+
Preconditions.checkNotNull(decorator);
DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -26,11 +26,14 @@
import com.google.common.base.Preconditions;
import fr.ifremer.tutti.service.TuttiServiceTechnicalException;
+import fr.ifremer.tutti.ui.swing.util.TuttiColorHighlighter;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
import org.nuiton.util.FileUtil;
import javax.swing.Action;
@@ -41,6 +44,7 @@
import javax.swing.JRootPane;
import javax.swing.KeyStroke;
import javax.swing.UIManager;
+import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
@@ -242,4 +246,12 @@
throw new TuttiServiceTechnicalException("Could not get property '" + property + "' on object of type '" + bean.getClass().getName() + "'", e);
}
}
+
+ public static Highlighter newBackgroundColorHighlighter(HighlightPredicate predicate, Color color) {
+ return new TuttiColorHighlighter(predicate, color, false);
+ }
+
+ public static Highlighter newForegroundColorHighlighter(HighlightPredicate predicate, Color color) {
+ return new TuttiColorHighlighter(predicate, color, true);
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-04 17:59:54 UTC (rev 27)
@@ -26,7 +26,9 @@
<import>
fr.ifremer.tutti.persistence.entities.TraitBean
+
fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTabUI
jaxx.runtime.swing.editor.bean.BeanComboBox
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css 2012-12-04 17:59:54 UTC (rev 27)
@@ -1,83 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightLabel {
- text:"tutti.label.fishes.totalWeight";
- labelFor:{totalWeightField};
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#totalVracWeightLabel {
- text:"tutti.label.fishes.totalVracWeight";
- labelFor:{totalVracWeightField};
-}
-
-#totalVracWeightField {
- property:"totalVracWeight";
- model:{model.getTotalVracWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleVracWeightLabel {
- text:"tutti.label.fishes.sampleVracWeight";
- labelFor:{sampleVracWeightField};
-}
-
-#sampleVracWeightField {
- property:"sampleVracWeight";
- model:{model.getSampleVracWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#totalHorsVracWeightLabel {
- text:"tutti.label.fishes.totalHorsVracWeight";
- labelFor:{totalHorsVracWeightField};
-}
-
-#totalHorsVracWeightField {
- property:"totalHorsVracWeight";
- model:{model.getTotalHorsVracWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx 2012-12-04 17:59:54 UTC (rev 27)
@@ -1,114 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<JPanel id='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesTabUIModel, SpeciesTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
- fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public SpeciesTabUI(CatchesUI parentUI) {
- SpeciesTabUIHandler handler = new SpeciesTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <SpeciesTabUIHandler id='handler'
- initializer='getContextValue(SpeciesTabUIHandler.class)'/>
-
- <SpeciesTabUIModel id='model'
- initializer='getContextValue(SpeciesTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='totalVracWeight' component='totalVracWeightField'/>
- <field name='sampleVracWeight' component='sampleVracWeightField'/>
- <field name='totalHorsVracWeight' component='totalHorsVracWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total / Poids total vrac -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- <cell anchor='west'>
- <JLabel id='totalVracWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalVracWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids échantillonné vrac / Poids total hors vrac -->
- <row>
- <cell>
- <JLabel id='sampleVracWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleVracWeightField' constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='totalHorsVracWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='totalHorsVracWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -1,290 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.VracHorsVracEnum;
-import fr.ifremer.tutti.persistence.entities.referential.SexBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import jaxx.runtime.SwingUtil;
-import jaxx.runtime.swing.editor.EnumEditor;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesTabUIHandler extends AbstractTuttiUIHandler<SpeciesTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
-
- private final SpeciesTabUI ui;
-
- private final CatchesUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public SpeciesTabUIHandler(CatchesUI parentUi, SpeciesTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- SpeciesTabUIModel model = new SpeciesTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // Espèce à confirmer
- col = new TableColumn(0);
- col.setCellEditor(SwingUtil.newBooleanTableCellEditor(defaultRenderer));
- col.setCellRenderer(SwingUtil.newBooleanTableCellRenderer(defaultRenderer));
- col.setHeaderValue(_("tutti.table.species.header.toConfirm"));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.speciesToConfirm);
- columnModel.addColumn(col);
-
- // species (by code) column
- col = new TableColumn(1);
-
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
- JComboBox speciesEditor = new JComboBox();
- speciesEditor.setRenderer(newListCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE));
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
- col.setCellEditor(new ComboBoxCellEditor(speciesEditor));
- col.setCellRenderer(newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE));
- col.setHeaderValue(_("tutti.table.species.header.speciesByCode"));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.speciesByCode);
- columnModel.addColumn(col);
-
- // species (by genusCode) column
- col = new TableColumn(2);
-
- JComboBox speciesEditor2 = new JComboBox();
- speciesEditor2.setRenderer(newListCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_GENUS));
- SwingUtil.fillComboBox(speciesEditor2, allSpecies, null);
- col.setCellEditor(new ComboBoxCellEditor(speciesEditor2));
- col.setCellRenderer(newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_GENUS));
- col.setHeaderValue(_("tutti.table.species.header.speciesByGenusCode"));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.speciesByGenusCode);
- columnModel.addColumn(col);
-
- // Vrac / Hors vrac
- col = new TableColumn(3);
-
- EnumEditor<VracHorsVracEnum> vracEditor = EnumEditor.newEditor(VracHorsVracEnum.values());
-
- col.setCellEditor(new ComboBoxCellEditor(vracEditor));
-// col.setCellRenderer(SwingUtil.newEnumTableCellRenderer(defaultRenderer, VracHorsVracEnum.class));
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.vracHorsVrac"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.vracHorsVrac);
- columnModel.addColumn(col);
-
- // Catégorie de poids
- col = new TableColumn(4);
-
- JComboBox weightCategoryCombo = new JComboBox();
- weightCategoryCombo.setRenderer(newListCellRender(WeightCategoryBean.class, DecoratorService.BY_NAME));
- SwingUtil.fillComboBox(weightCategoryCombo, persistenceService.getAllWeightCategories(), null);
- col.setCellEditor(new ComboBoxCellEditor(weightCategoryCombo));
- col.setCellRenderer(newTableCellRender(WeightCategoryBean.class, DecoratorService.BY_NAME));
- col.setHeaderValue(_("tutti.table.species.header.weightCategory"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.weightCategory);
- columnModel.addColumn(col);
-
- // Sex
- col = new TableColumn(5);
-
- JComboBox sexCombo = new JComboBox();
- sexCombo.setRenderer(newListCellRender(SexBean.class, DecoratorService.BY_NAME));
- SwingUtil.fillComboBox(sexCombo, persistenceService.getAllSex(), null);
- col.setCellEditor(new ComboBoxCellEditor(sexCombo));
- col.setCellRenderer(newTableCellRender(SexBean.class, DecoratorService.BY_NAME));
-
- col.setHeaderValue(_("tutti.table.species.header.sex"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.sex);
- columnModel.addColumn(col);
-
- // Maturity
- col = new TableColumn(6);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.maturity"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.maturity);
- columnModel.addColumn(col);
-
- // Age
- col = new TableColumn(7);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.age"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.age);
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(8);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.weight);
- columnModel.addColumn(col);
-
- // Poids calculé
- col = new TableColumn(9);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.computedWeight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.computedWeight);
- columnModel.addColumn(col);
-
- // Nombre calculé
- col = new TableColumn(10);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.computedNumber"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.computedNumber);
- columnModel.addColumn(col);
-
- // Poids d'échantillon
- col = new TableColumn(11);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.sampleWeight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.sampleWeight);
- columnModel.addColumn(col);
-
- // Fraction d'élévation
- col = new TableColumn(12);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.elevationRate"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.elevationRatio);
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final SpeciesTableModel tableModel = new SpeciesTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(SpeciesTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
- }
- });
- }
-
- @Override
- public void afterInitUI() {
- SpeciesTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected SpeciesTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectTrait(TraitBean bean) {
-
- boolean empty = bean == null;
-
- SpeciesTabUIModel model = ui.getModel();
-
- List<TraitSpeciesCatchBean> catches;
-
- if (empty) {
- catches = null;
- bean = new TraitBean();
- } else {
- catches = persistenceService.getAllTraitSpeciesCatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
-
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -1,123 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_TOTAL_VRAC_WEIGHT = "totalVracWeight";
-
- public static final String PROPERTY_SAMPLE_VRAC_WEIGHT = "sampleVracWeight";
-
- public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float totalVracWeight;
-
- protected Float sampleVracWeight;
-
- protected Float totalHorsVracWeight;
-
- protected List<TraitSpeciesCatchBean> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getTotalVracWeight() {
- return totalVracWeight;
- }
-
- public void setTotalVracWeight(Float totalVracWeight) {
- Object oldValue = getTotalVracWeight();
- this.totalVracWeight = totalVracWeight;
- firePropertyChange(PROPERTY_TOTAL_VRAC_WEIGHT, oldValue, totalVracWeight);
- }
-
- public Float getSampleVracWeight() {
- return sampleVracWeight;
- }
-
- public void setSampleVracWeight(Float sampleVracWeight) {
- Object oldValue = getSampleVracWeight();
- this.sampleVracWeight = sampleVracWeight;
- firePropertyChange(PROPERTY_SAMPLE_VRAC_WEIGHT, oldValue, sampleVracWeight);
- }
-
- public Float getTotalHorsVracWeight() {
- return totalHorsVracWeight;
- }
-
- public void setTotalHorsVracWeight(Float totalHorsVracWeight) {
- Object oldValue = getTotalHorsVracWeight();
- this.totalHorsVracWeight = totalHorsVracWeight;
- firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight);
- }
-
- public List<TraitSpeciesCatchBean> getCatches() {
- return catches;
- }
-
- public void setCatches(List<TraitSpeciesCatchBean> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- SpeciesTabUIModel.class).copy(bean, this);
- }
-
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(SpeciesTabUIModel.class,
- TraitBean.class).copy(this, result);
- return result;
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -1,180 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
-import jaxx.runtime.SwingUtil;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesTableModel extends AbstractTableModel {
-
- public static enum ColumnIdentifier {
- speciesToConfirm,
- speciesByCode("species"),
- speciesByGenusCode("species"),
- vracHorsVrac,
- weightCategory,
- sex,
- maturity,
- age,
- weight,
- computedWeight(null),
- computedNumber(null),
- sampleWeight,
- elevationRatio;
-
- final String propertyName;
-
- ColumnIdentifier() {
- this("");
- }
-
- ColumnIdentifier(String propertyName) {
- this.propertyName = "".equals(propertyName) ? name() : propertyName;
- }
-
- public void setValue(TraitSpeciesCatchBean entry, Object value) {
- if (propertyName != null)
- TuttiUIUtil.setProperty(entry, propertyName, value);
- }
-
- public Object getValue(TraitSpeciesCatchBean entry) {
- Object result = null;
- if (propertyName != null) {
- result = TuttiUIUtil.getProperty(entry, propertyName);
- }
- return result;
- }
- }
-
- private static final long serialVersionUID = 1L;
-
- protected List<TraitSpeciesCatchBean> data;
-
- protected final List<ColumnIdentifier> columnIdentifiers;
-
- protected final TableColumn[] columns;
-
- protected final TraitSpeciesCatchBean newRow = new TraitSpeciesCatchBean();
-
- public SpeciesTableModel(TableColumnModel columnModel) {
-
- int nbcols = columnModel.getColumnCount();
- columns = new TableColumn[nbcols];
- columnIdentifiers = Lists.newArrayList();
- for (int i = 0; i < nbcols; i++) {
- TableColumn column = columnModel.getColumn(i);
- columns[i] = column;
- columnIdentifiers.add((ColumnIdentifier) column.getIdentifier());
- }
- }
-
- public void setData(List<TraitSpeciesCatchBean> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return (data == null ? 0 : data.size()) + 1;
- }
-
- @Override
- public int getColumnCount() {
- return columns.length;
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- TraitSpeciesCatchBean entry = getEntry(rowIndex);
- ColumnIdentifier propertyName = getPropertyName(columnIndex);
- Object result = propertyName.getValue(entry);
- return result;
- }
-
- @Override
- public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
- TraitSpeciesCatchBean entry = getEntry(rowIndex);
- ColumnIdentifier propertyName = getPropertyName(columnIndex);
- propertyName.setValue(entry, aValue);
-
- if (propertyName == ColumnIdentifier.speciesByCode) {
-
- // update also speciesByGenusCode column
- int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByGenusCode);
- fireTableCellUpdated(rowIndex, otherColumnIndex);
- } else if (propertyName == ColumnIdentifier.speciesByGenusCode) {
-
- // update also speciesByCode column
- int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByCode);
- fireTableCellUpdated(rowIndex, otherColumnIndex);
- }
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-
- protected TraitSpeciesCatchBean getEntry(int rowIndex) {
- SwingUtil.ensureRowIndex(this, rowIndex);
- TraitSpeciesCatchBean result;
- if (data == null || rowIndex >= data.size()) {
- result = newRow;
- } else {
- result = data.get(rowIndex);
- }
- return result;
- }
-
- protected TableColumn getColumn(int columnIndex) {
- SwingUtil.ensureColumnIndex(this, columnIndex);
- return columns[columnIndex];
- }
-
- protected ColumnIdentifier getPropertyName(int columnIndex) {
- TableColumn column = getColumn(columnIndex);
- return (ColumnIdentifier) column.getIdentifier();
- }
-
- protected int getColumnIndex(ColumnIdentifier property) {
- int result = columnIdentifiers.indexOf(property);
- return result;
- }
-}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,99 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.AbstractAction;
+import javax.swing.JTable;
+
+/**
+ * Abstract action to select something in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public abstract class AbstractSelectTableAction extends AbstractAction {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(AbstractSelectTableAction.class);
+
+ private final JTable table;
+
+ private final SpeciesTabUIModel model;
+
+ public AbstractSelectTableAction(SpeciesTabUIModel model,
+ JTable table) {
+ this.model = model;
+ this.table = table;
+ }
+
+ protected void doSelectCell(int rowIndex, int columnIndex) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Will select cell at " +
+ getCellCoordinate(rowIndex, columnIndex));
+ }
+
+ table.editCellAt(rowIndex, columnIndex);
+ table.setColumnSelectionInterval(columnIndex, columnIndex);
+ table.setRowSelectionInterval(rowIndex, rowIndex);
+ }
+
+
+ protected int getSelectedRow() {
+ int result = table.getSelectedRow();
+ return result;
+ }
+
+ protected int getSelectedColumn() {
+ int result = table.getSelectedColumn();
+ return result;
+ }
+
+ protected int getRowCount() {
+ return table.getRowCount();
+ }
+
+ protected int getColumnCount() {
+ return table.getColumnCount();
+ }
+
+ protected boolean isCellEditable(int rowIndex, int columnIndex) {
+ return table.isCellEditable(rowIndex, columnIndex);
+ }
+
+ protected String getCellCoordinate(int rowIndex, int columnIndex) {
+ return " [" + rowIndex + ", " + columnIndex + "]";
+ }
+
+ protected SpeciesTabUIModel getModel() {
+ return model;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,104 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class CatchTreeModel implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Root node (with no sampling on it.
+ *
+ * @since 0.2
+ */
+ protected final CatchTreeNode root;
+
+ /**
+ * Property which are used to sub sampling.
+ *
+ * @since 0.2
+ */
+ protected final String[] samplingOrder;
+
+ /**
+ * Samplings view as a linear list (to display in the table).
+ *
+ * @since 0.2
+ */
+ protected final List<CatchTreeNode> lines;
+
+ public CatchTreeModel(String... samplingOrder) {
+ this.samplingOrder = samplingOrder;
+ root = new CatchTreeNode();
+ lines = Lists.newArrayList();
+ }
+
+ public CatchTreeNode getNode(int rowIndex) {
+ return lines.get(rowIndex);
+ }
+
+ public int getSize() {
+ return lines.size();
+ }
+
+ public void populate(List<TraitSpeciesCatchBean> data) {
+
+ // clear tree representation
+ root.removeAllChildren();
+
+ // clear linear representation
+ lines.clear();
+ }
+
+ public Object[] getSamplingKey(TraitSpeciesCatchBean bean) {
+ List<Object> result = Lists.newArrayList();
+ for (String s : samplingOrder) {
+ Object property = TuttiUIUtil.getProperty(bean, s);
+ if (property == null) {
+ // stop findind sample key
+ break;
+ }
+ result.add(property);
+ }
+ return result.toArray();
+ }
+
+ public String[] getSamplingDefinition(TraitSpeciesCatchBean bean) {
+ return null;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,152 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeNode;
+import java.io.Serializable;
+
+/**
+ * Defines a node of a species catches.
+ * <p/>
+ * UserObject is the {@link TraitSpeciesCatchBean}. It can be null on two cases:
+ * <ul>
+ * <li>On root node</li>
+ * <li>For node on a path of sampling but with no filled data </li>
+ * </ul>
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class CatchTreeNode extends DefaultMutableTreeNode {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Property name defining the sampling.
+ * <p/>
+ * <strong>Note:</strong> can be null (only for root node).
+ *
+ * @since 0.2
+ */
+ protected final String samplingPropertyKey;
+
+ /**
+ * Property value defining the sampling.
+ * <p/>
+ * <strong>Note:</strong> can be null (only for root node).
+ *
+ * @since 0.2
+ */
+ protected final Serializable samplingPropertyValue;
+
+ public CatchTreeNode() {
+ this(null, null, null);
+ }
+
+ public CatchTreeNode(TraitSpeciesCatchBean userObject,
+ String samplingPropertyKey,
+ Serializable samplingPropertyValue) {
+ this.samplingPropertyKey = samplingPropertyKey;
+ this.samplingPropertyValue = samplingPropertyValue;
+ setUserObject(userObject);
+ }
+
+ public String getSamplingPropertyKey() {
+ return samplingPropertyKey;
+ }
+
+ public Serializable getSamplingPropertyValue() {
+ return samplingPropertyValue;
+ }
+
+ @Override
+ public TraitSpeciesCatchBean getUserObject() {
+ return (TraitSpeciesCatchBean) super.getUserObject();
+ }
+
+ @Override
+ public CatchTreeNode getParent() {
+ return (CatchTreeNode) super.getParent();
+ }
+
+ @Override
+ public CatchTreeNode getRoot() {
+ return (CatchTreeNode) super.getRoot();
+ }
+
+ @Override
+ public CatchTreeNode getFirstChild() {
+ return (CatchTreeNode) super.getFirstChild();
+ }
+
+ @Override
+ public CatchTreeNode getLastChild() {
+ return (CatchTreeNode) super.getLastChild();
+ }
+
+ @Override
+ public CatchTreeNode getChildAfter(TreeNode aChild) {
+ return (CatchTreeNode) super.getChildAfter(aChild);
+ }
+
+ @Override
+ public CatchTreeNode getChildBefore(TreeNode aChild) {
+ return (CatchTreeNode) super.getChildBefore(aChild);
+ }
+
+ @Override
+ public CatchTreeNode getNextSibling() {
+ return (CatchTreeNode) super.getNextSibling();
+ }
+
+ @Override
+ public CatchTreeNode getPreviousSibling() {
+ return (CatchTreeNode) super.getPreviousSibling();
+ }
+
+ @Override
+ public CatchTreeNode getFirstLeaf() {
+ return (CatchTreeNode) super.getFirstLeaf();
+ }
+
+ @Override
+ public CatchTreeNode getLastLeaf() {
+ return (CatchTreeNode) super.getLastLeaf();
+ }
+
+ @Override
+ public CatchTreeNode getNextLeaf() {
+ return (CatchTreeNode) super.getNextLeaf();
+ }
+
+ @Override
+ public CatchTreeNode getPreviousLeaf() {
+ return (CatchTreeNode) super.getPreviousLeaf();
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,98 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
+/**
+ * Action to select next editable cell in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MoveToNextEditableCellAction extends AbstractSelectTableAction {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MoveToNextEditableCellAction.class);
+
+ public MoveToNextEditableCellAction(SpeciesTabUIModel model,
+ JTable table) {
+ super(model, table);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ int currentRow = getSelectedRow();
+ int currentColumn = getSelectedColumn();
+
+ if (log.isDebugEnabled()) {
+ log.debug("Move to previous editable cell " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+
+ int columnCount = getColumnCount();
+
+ int rowCount = getRowCount();
+
+ while (currentRow <= rowCount || currentColumn <= columnCount) {
+
+ // go to next cell
+ currentColumn++;
+
+ // select next cell
+ if (currentColumn >= columnCount) {
+
+ // no more cell, so will move to next editable column on next row
+ currentColumn = 0;
+ currentRow++;
+
+ if (currentRow == rowCount) {
+ // create a new row in model
+ getModel().addNewCatch();
+ }
+ }
+
+ if (isCellEditable(currentRow, currentColumn)) {
+
+ doSelectCell(currentRow, currentColumn);
+
+ break;
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cell not editable at " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,82 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
+/**
+ * Action to select next editable row in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MoveToNextEditableRowAction extends AbstractSelectTableAction {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MoveToNextEditableRowAction.class);
+
+ public MoveToNextEditableRowAction(SpeciesTabUIModel model,
+ JTable table) {
+ super(model, table);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ int currentRow = getSelectedRow();
+ int currentColumn = getSelectedColumn();
+
+ if (isCellEditable(currentRow, currentColumn)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Move to next row editable cell " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ currentRow++;
+
+ if (currentRow >= getRowCount()) {
+ if (log.isDebugEnabled()) {
+ log.debug("No next row");
+ }
+
+ // create a new row in model
+ getModel().addNewCatch();
+ }
+
+ doSelectCell(currentRow, currentColumn);
+
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cell not editable at " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ }
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,87 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
+/**
+ * Action to select previous editable cell in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MoveToPreviousEditableCellAction extends AbstractSelectTableAction {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MoveToPreviousEditableCellAction.class);
+
+ public MoveToPreviousEditableCellAction(SpeciesTabUIModel model,
+ JTable table) {
+ super(model,table);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ int currentRow = getSelectedRow();
+ int currentColumn = getSelectedColumn();
+
+ if (log.isDebugEnabled()) {
+ log.debug("Move to previous editable cell, " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+
+ int columnCount = getColumnCount();
+
+ while (currentRow > 0 || currentColumn > 0) {
+
+ // go to next cell
+ currentColumn--;
+
+ // select next cell
+ if (currentColumn < 0) {
+
+ currentColumn = columnCount - 1;
+ currentRow--;
+ }
+
+ if (isCellEditable(currentRow, currentColumn)) {
+ doSelectCell(currentRow, currentColumn);
+ break;
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cell not editable at " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,79 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
+/**
+ * Action to select previous editable row in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MoveToPreviousEditableRowAction extends AbstractSelectTableAction {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MoveToPreviousEditableRowAction.class);
+
+ public MoveToPreviousEditableRowAction(SpeciesTabUIModel model,
+ JTable table) {
+ super(model,table);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ int currentRow = getSelectedRow();
+ int currentColumn = getSelectedColumn();
+
+ if (isCellEditable(currentRow, currentColumn)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Move to previous row editable cell " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ currentRow--;
+
+ if (currentRow < 0) {
+ if (log.isDebugEnabled()) {
+ log.debug("No previous row");
+ }
+ } else {
+ doSelectCell(currentRow, currentColumn);
+ }
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cell not editable at " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ }
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,281 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.VracHorsVracEnum;
+import fr.ifremer.tutti.persistence.entities.referential.SexBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ * represents a row in the table
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesCatchEntryModel extends AbstractTuttiBeanUIModel {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_SPECIES = "species";
+
+ public static final String PROPERTY_SPECIES_TO_CONFIRM = "speciesToConfirm";
+
+ public static final String PROPERTY_VRAC_HORS_VRAC = "vracHorsVrac";
+
+ public static final String PROPERTY_WEIGHT_CATEGORY = "weightCategory";
+
+ public static final String PROPERTY_SEX = "sex";
+
+ public static final String PROPERTY_MATURITY = "maturity";
+
+ public static final String PROPERTY_AGE = "age";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
+
+ public static final String PROPERTY_ELEVATION_RATIO = "elevationRatio";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ /**
+ * When catch was observed.
+ *
+ * @since 0.2
+ */
+ protected TraitBean trait;
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected SpeciesBean species;
+
+ /**
+ * Is the species need to be confirmed?.
+ *
+ * @since 0.2
+ */
+ protected boolean speciesToConfirm;
+
+ /**
+ * Is catch is vrac or horsVrac?.
+ *
+ * @since 0.2
+ */
+ protected VracHorsVracEnum vracHorsVrac;
+
+ /**
+ * Weight category (can be null).
+ *
+ * @since 0.2
+ */
+ protected WeightCategoryBean weightCategory;
+
+ /**
+ * Sex (can be null).
+ *
+ * @since 0.2
+ */
+ protected SexBean sex;
+
+ /**
+ * Maturity (can be null).
+ *
+ * @since 0.2
+ */
+ protected Float maturity;
+
+ /**
+ * Age (can be null).
+ *
+ * @since 0.2
+ */
+ protected Float age;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Sample weight.
+ *
+ * @since 0.2
+ */
+ protected Float sampleWeight;
+
+ /**
+ * Elevation ratio.
+ *
+ * @since 0.2
+ */
+ protected Float elevationRatio;
+
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ public TraitBean getTrait() {
+ return trait;
+ }
+
+ public void setTrait(TraitBean trait) {
+ this.trait = trait;
+ }
+
+ public SpeciesBean getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(SpeciesBean species) {
+ Object oldValue = getSpecies();
+ this.species = species;
+ firePropertyChange(PROPERTY_SPECIES, oldValue, species);
+ }
+
+ public Boolean getSpeciesToConfirm() {
+ return speciesToConfirm;
+ }
+
+ public void setSpeciesToConfirm(Boolean speciesToConfirm) {
+ Object oldValue = getSpeciesToConfirm();
+ this.speciesToConfirm = speciesToConfirm;
+ firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
+ }
+
+ public VracHorsVracEnum getVracHorsVrac() {
+ return vracHorsVrac;
+ }
+
+ public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) {
+ Object oldValue = getVracHorsVrac();
+ this.vracHorsVrac = vracHorsVrac;
+ firePropertyChange(PROPERTY_VRAC_HORS_VRAC, oldValue, vracHorsVrac);
+ }
+
+ public WeightCategoryBean getWeightCategory() {
+ return weightCategory;
+ }
+
+ public void setWeightCategory(WeightCategoryBean weightCategory) {
+ Object oldValue = getWeightCategory();
+ this.weightCategory = weightCategory;
+ firePropertyChange(PROPERTY_WEIGHT_CATEGORY, oldValue, weightCategory);
+ }
+
+ public SexBean getSex() {
+ return sex;
+ }
+
+ public void setSex(SexBean sex) {
+ Object oldValue = getSex();
+ this.sex = sex;
+ firePropertyChange(PROPERTY_SEX, oldValue, sex);
+ }
+
+ public Float getMaturity() {
+ return maturity;
+ }
+
+ public void setMaturity(Float maturity) {
+ Object oldValue = getMaturity();
+ this.maturity = maturity;
+ firePropertyChange(PROPERTY_MATURITY, oldValue, maturity);
+ }
+
+ public Float getAge() {
+ return age;
+ }
+
+ public void setAge(Float age) {
+ Object oldValue = getAge();
+ this.age = age;
+ firePropertyChange(PROPERTY_AGE, oldValue, age);
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public Float getSampleWeight() {
+ return sampleWeight;
+ }
+
+ public void setSampleWeight(Float sampleWeight) {
+ Object oldValue = getSampleWeight();
+ this.sampleWeight = sampleWeight;
+ firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
+ }
+
+ public Float getElevationRatio() {
+ return elevationRatio;
+ }
+
+ public void setElevationRatio(Float elevationRatio) {
+ Object oldValue = getElevationRatio();
+ this.elevationRatio = elevationRatio;
+ firePropertyChange(PROPERTY_ELEVATION_RATIO, oldValue, elevationRatio);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public void fromBean(TraitSpeciesCatchBean bean) {
+ BinderFactory.newBinder(TraitSpeciesCatchBean.class,
+ SpeciesCatchEntryModel.class).copy(bean, this);
+ }
+
+ public TraitSpeciesCatchBean toBean() {
+ TraitSpeciesCatchBean result = new TraitSpeciesCatchBean();
+ BinderFactory.newBinder(SpeciesCatchEntryModel.class,
+ TraitSpeciesCatchBean.class).copy(this, result);
+ return result;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,84 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.fishes.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#totalVracWeightLabel {
+ text:"tutti.label.fishes.totalVracWeight";
+ labelFor:{totalVracWeightField};
+}
+
+#totalVracWeightField {
+ property:"totalVracWeight";
+ model:{model.getTotalVracWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleVracWeightLabel {
+ text:"tutti.label.fishes.sampleVracWeight";
+ labelFor:{sampleVracWeightField};
+}
+
+#sampleVracWeightField {
+ property:"sampleVracWeight";
+ model:{model.getSampleVracWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#totalHorsVracWeightLabel {
+ text:"tutti.label.fishes.totalHorsVracWeight";
+ labelFor:{totalHorsVracWeightField};
+}
+
+#totalHorsVracWeightField {
+ property:"totalHorsVracWeight";
+ model:{model.getTotalHorsVracWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ selectionMode:{ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground:{null};
+ selectionForeground:{Color.BLACK};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,120 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesTabUIModel, SpeciesTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
+ fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
+ fr.ifremer.tutti.persistence.entities.StrataBean
+ fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.referential.UserBean
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+
+ org.jdesktop.swingx.JXTable
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.ListSelectionModel
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public SpeciesTabUI(CatchesUI parentUI) {
+ SpeciesTabUIHandler handler = new SpeciesTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <SpeciesTabUIHandler id='handler'
+ initializer='getContextValue(SpeciesTabUIHandler.class)'/>
+
+ <SpeciesTabUIModel id='model'
+ initializer='getContextValue(SpeciesTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='totalVracWeight' component='totalVracWeightField'/>
+ <field name='sampleVracWeight' component='sampleVracWeightField'/>
+ <field name='totalHorsVracWeight' component='totalHorsVracWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total / Poids total vrac -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='totalVracWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalVracWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids échantillonné vrac / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='sampleVracWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleVracWeightField' constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='totalHorsVracWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='totalHorsVracWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
+ </JScrollPane>
+
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,568 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.TuttiBeans;
+import fr.ifremer.tutti.persistence.entities.VracHorsVracEnum;
+import fr.ifremer.tutti.persistence.entities.referential.SexBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.JAXXWidgetUtil;
+import jaxx.runtime.swing.editor.EnumEditor;
+import jaxx.runtime.swing.editor.bean.BeanUIUtil;
+import jaxx.runtime.swing.editor.cell.NumberCellEditor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
+import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.jdesktop.swingx.table.TableColumnExt;
+import org.nuiton.util.beans.BeanMonitor;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.JComboBox;
+import javax.swing.ListSelectionModel;
+import javax.swing.border.LineBorder;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.FocusEvent;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTableModel.ColumnIdentifier;
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesTabUIHandler extends AbstractTuttiUIHandler<SpeciesTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
+
+ private final SpeciesTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ private final BeanMonitor monitor;
+
+ public SpeciesTabUIHandler(CatchesUI parentUi, SpeciesTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ monitor = new BeanMonitor(
+ SpeciesCatchEntryModel.PROPERTY_SPECIES,
+ SpeciesCatchEntryModel.PROPERTY_SPECIES_TO_CONFIRM,
+ SpeciesCatchEntryModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesCatchEntryModel.PROPERTY_WEIGHT_CATEGORY,
+ SpeciesCatchEntryModel.PROPERTY_SEX,
+ SpeciesCatchEntryModel.PROPERTY_MATURITY,
+ SpeciesCatchEntryModel.PROPERTY_AGE,
+ SpeciesCatchEntryModel.PROPERTY_WEIGHT,
+ SpeciesCatchEntryModel.PROPERTY_SAMPLE_WEIGHT,
+ SpeciesCatchEntryModel.PROPERTY_ELEVATION_RATIO,
+ SpeciesCatchEntryModel.PROPERTY_COMMENT);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ SpeciesTabUIModel model = new SpeciesTabUIModel();
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+
+ JXTable table = ui.getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel(table);
+
+ SpeciesTabUIModel model = ui.getModel();
+
+ // create table model
+ final SpeciesTableModel tableModel = new SpeciesTableModel(columnModel, model);
+
+ // when model datas change let's propagate it
+
+ model.addPropertyChangeListener(SpeciesTabUIModel.PROPERTY_ROWS, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.refreshData((List<SpeciesCatchEntryModel>) evt.getNewValue());
+ }
+ });
+ model.addPropertyChangeListener(SpeciesTabUIModel.PROPERTY_NEW_ROW, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.addNewRow((SpeciesCatchEntryModel) evt.getNewValue());
+ }
+ });
+
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+ table.getTableHeader().setReorderingAllowed(false);
+
+ table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
+
+ table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
+ if (!e.getValueIsAdjusting()) {
+ ListSelectionModel source = (ListSelectionModel) e.getSource();
+ int selectedRow = source.getLeadSelectionIndex();
+
+ // save selected entry if required
+ saveSelectedRowIfRequired();
+
+ if (log.isInfoEnabled()) {
+ log.info("New selected row: " + selectedRow);
+ }
+
+ SpeciesCatchEntryModel entry =
+ tableModel.getEntry(selectedRow);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will monitor entry: " + entry);
+ }
+ monitor.setBean(entry);
+ }
+ }
+ });
+ }
+
+ public void saveSelectedRowIfRequired(FocusEvent event) {
+ Component oppositeComponent = event.getOppositeComponent();
+
+ JXTable parentContainer = SwingUtil.getParentContainer(
+ oppositeComponent, JXTable.class);
+
+ if (parentContainer == null) {
+
+ // out of the table can save
+ saveSelectedRowIfRequired();
+ }
+ }
+
+ public void saveSelectedRowIfRequired() {
+
+ SpeciesCatchEntryModel bean = (SpeciesCatchEntryModel) monitor.getBean();
+ if (bean != null) {
+
+ // there is a bean attached to the monitor
+
+ if (monitor.wasModified()) {
+
+ // monitored bean was modified, save it
+ if (log.isInfoEnabled()) {
+ log.info("Row " + bean + " was modified, will save it");
+ }
+
+ TraitSpeciesCatchBean catchBean = bean.toBean();
+
+ TraitBean trait = parentUi.getModel().getSelectedTrait();
+ catchBean.setTrait(trait);
+
+ if (TuttiBeans.isNew(catchBean)) {
+
+ catchBean = persistenceService.createTraitSpeciesCatch(catchBean);
+ bean.setId(catchBean.getId());
+ } else {
+ persistenceService.saveTraitSpeciesCatch(catchBean);
+ }
+
+ // clear modified flag on the monitor
+ monitor.clearModified();
+ }
+ }
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ // make sure selection is empty (will remove bean from monitor)
+ ui.getTable().clearSelection();
+
+ boolean empty = bean == null;
+
+ SpeciesTabUIModel model = ui.getModel();
+
+ List<SpeciesCatchEntryModel> rows;
+
+ if (empty) {
+ rows = null;
+ bean = new TraitBean();
+ } else {
+ List<TraitSpeciesCatchBean> catches =
+ persistenceService.getAllTraitSpeciesCatch(bean.getId());
+ rows = Lists.newArrayList();
+ for (TraitSpeciesCatchBean aCatch : catches) {
+ SpeciesCatchEntryModel entry = new SpeciesCatchEntryModel();
+ entry.setTrait(bean);
+ entry.fromBean(aCatch);
+ rows.add(entry);
+ }
+ }
+
+ model.fromBean(bean);
+ model.setCatches(rows);
+
+ //monitor.setBean(null);
+
+ rows = model.getRows();
+ monitor.setBean(rows.get(0));
+
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ @Override
+ protected SpeciesTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+
+ protected TableColumnModel createTableColumnModel(JXTable table) {
+
+ KeyListener keyAdapter = createTableKeyListener(getModel(), table);
+
+ {
+ NumberCellEditor<Float> editor =
+ JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
+ editor.getNumberEditor().setSelectAllTextOnError(true);
+ editor.getNumberEditor().getTextField().addKeyListener(keyAdapter);
+ editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
+ table.setDefaultEditor(float.class, editor);
+ table.setDefaultEditor(Float.class, editor);
+ }
+
+ // Boolean
+ {
+ TableCellRenderer renderer = table.getDefaultRenderer(Boolean.class);
+ table.setDefaultRenderer(boolean.class, renderer);
+
+ TableCellEditor editor = table.getDefaultEditor(Boolean.class);
+ table.setDefaultEditor(boolean.class, editor);
+ }
+
+ table.addKeyListener(keyAdapter);
+
+ // prepare the table column model
+ DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
+
+ { // Species to confirm
+
+ addColumnToModel(columnModel,
+ table.getDefaultEditor(Boolean.class),
+ table.getDefaultRenderer(Boolean.class),
+ _("tutti.table.species.header.toConfirm"),
+ ColumnIdentifier.speciesToConfirm);
+
+ }
+
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+
+ { // Species (by code)
+
+ Decorator<SpeciesBean> decorator = getDecorator(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE);
+
+ JComboBox comboBox = new JComboBox();
+ comboBox.setRenderer(newListCellRender(decorator));
+ SwingUtil.fillComboBox(comboBox, allSpecies, null);
+
+ ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
+ BeanUIUtil.decorate(comboBox, converter);
+ TableCellEditor editor = new ComboBoxCellEditor(comboBox);
+ TableCellRenderer renderer =
+ newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE);
+
+ addColumnToModel(columnModel,
+ editor,
+ renderer,
+ _("tutti.table.species.header.speciesByCode"),
+ ColumnIdentifier.speciesByCode);
+ }
+
+ { // Species (by genusCode)
+
+ Decorator<SpeciesBean> decorator =
+ getDecorator(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE);
+
+ JComboBox comboBox = new JComboBox();
+
+ comboBox.setRenderer(newListCellRender(decorator));
+ SwingUtil.fillComboBox(comboBox, allSpecies, null);
+
+ ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
+ BeanUIUtil.decorate(comboBox, converter);
+
+ TableCellEditor editor = new ComboBoxCellEditor(comboBox);
+ TableCellRenderer renderer = newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addColumnToModel(columnModel,
+ editor,
+ renderer,
+ _("tutti.table.species.header.speciesByGenusCode"),
+ ColumnIdentifier.speciesByGenusCode);
+
+ }
+
+ { // Vrac / Hors vrac
+
+ EnumEditor<VracHorsVracEnum> comboBox =
+ EnumEditor.newEditor(VracHorsVracEnum.values());
+ BeanUIUtil.decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION);
+ TableCellEditor editor = new ComboBoxCellEditor(comboBox);
+
+ addColumnToModel(columnModel,
+ editor,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.vracHorsVrac"),
+ ColumnIdentifier.vracHorsVrac);
+ }
+
+ { // Catégorie de poids
+
+ Decorator<WeightCategoryBean> decorator =
+ getDecorator(WeightCategoryBean.class, DecoratorService.BY_NAME);
+
+ JComboBox comboBox = new JComboBox();
+
+ comboBox.setRenderer(newListCellRender(decorator));
+ SwingUtil.fillComboBox(comboBox, persistenceService.getAllWeightCategories(), null);
+
+ ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
+ BeanUIUtil.decorate(comboBox, converter);
+
+ TableCellEditor editor = new ComboBoxCellEditor(comboBox);
+ TableCellRenderer renderer =
+ newTableCellRender(WeightCategoryBean.class, DecoratorService.BY_NAME);
+
+ addColumnToModel(columnModel,
+ editor,
+ renderer,
+ _("tutti.table.species.header.weightCategory"),
+ ColumnIdentifier.weightCategory);
+ }
+
+ { // Sex
+
+ Decorator<SexBean> decorator =
+ getDecorator(SexBean.class, DecoratorService.BY_NAME);
+
+ JComboBox comboBox = new JComboBox();
+ comboBox.setRenderer(newListCellRender(decorator));
+ SwingUtil.fillComboBox(comboBox, persistenceService.getAllSex(), null);
+
+ ObjectToStringConverter converter =
+ BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
+ BeanUIUtil.decorate(comboBox, converter);
+
+ TableCellEditor editor = new ComboBoxCellEditor(comboBox);
+ TableCellRenderer renderer =
+ newTableCellRender(SexBean.class, DecoratorService.BY_NAME);
+
+ addColumnToModel(columnModel,
+ editor,
+ renderer,
+ _("tutti.table.species.header.sex"),
+ ColumnIdentifier.sex);
+ }
+
+ { // Maturity
+
+ addColumnToModel(columnModel,
+ table.getDefaultEditor(Float.class),
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.maturity"),
+ ColumnIdentifier.maturity);
+ }
+
+ { // Age
+
+ addColumnToModel(columnModel,
+ table.getDefaultEditor(Float.class),
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.age"),
+ ColumnIdentifier.age);
+ }
+
+ { // Poids observé
+
+ addColumnToModel(columnModel,
+ table.getDefaultEditor(Float.class),
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.weight"),
+ ColumnIdentifier.weight);
+ }
+
+ { // Poids calculé
+
+ addColumnToModel(columnModel,
+ null,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.computedWeight"),
+ ColumnIdentifier.computedWeight);
+ }
+
+ { // Nombre calculé
+
+ addColumnToModel(columnModel,
+ null,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.computedNumber"),
+ ColumnIdentifier.computedNumber);
+ }
+
+ { // Poids d'échantillon
+
+ addColumnToModel(columnModel,
+ null,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.sampleWeight"),
+ ColumnIdentifier.sampleWeight);
+ }
+
+ { // Fraction d'élévation
+
+ addColumnToModel(columnModel,
+ null,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.elevationRate"),
+ ColumnIdentifier.elevationRatio);
+ }
+
+ { // Commentaire
+
+ addColumnToModel(columnModel,
+ null,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.comment"),
+ ColumnIdentifier.comment);
+ }
+
+ { // Pièces-jointes
+
+ addColumnToModel(columnModel,
+ null,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.file"),
+ ColumnIdentifier.file);
+ }
+ return columnModel;
+ }
+
+ private KeyListener createTableKeyListener(SpeciesTabUIModel model, JXTable table) {
+ final MoveToNextEditableCellAction nextCellAction = new MoveToNextEditableCellAction(model, table);
+ final MoveToPreviousEditableCellAction previousCellAction = new MoveToPreviousEditableCellAction(model, table);
+
+ final MoveToNextEditableRowAction nextRowAction = new MoveToNextEditableRowAction(model, table);
+ final MoveToPreviousEditableRowAction previousRowAction = new MoveToPreviousEditableRowAction(model, table);
+
+ // Key adapter à ajouter sur les éditeurs où l'on souhaite gérer les
+ // touches "entrer", "gauche", "doite" de facon personnalisée.
+ return new KeyAdapter() {
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER ||
+ e.getKeyCode() == KeyEvent.VK_RIGHT ||
+ e.getKeyCode() == KeyEvent.VK_TAB) {
+ e.consume();
+ nextCellAction.actionPerformed(null);
+ } else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
+ e.consume();
+ previousCellAction.actionPerformed(null);
+ } else if (e.getKeyCode() == KeyEvent.VK_UP) {
+ e.consume();
+ previousRowAction.actionPerformed(null);
+ } else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
+ e.consume();
+ nextRowAction.actionPerformed(null);
+ } else if (e.getKeyCode() == KeyEvent.VK_DOWN && e.isControlDown()) {
+ e.consume();
+
+ // create a new line with same sample
+ }
+ }
+ };
+ }
+
+ protected void addColumnToModel(TableColumnModel model,
+ TableCellEditor editor,
+ TableCellRenderer renderer,
+ String header,
+ Object identifier) {
+
+ TableColumn col = new TableColumnExt(model.getColumnCount());
+ col.setCellEditor(editor);
+ col.setCellRenderer(renderer);
+ col.setHeaderValue(header);
+ col.setIdentifier(identifier);
+ model.addColumn(col);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,156 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(SpeciesTabUIModel.class);
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_TOTAL_VRAC_WEIGHT = "totalVracWeight";
+
+ public static final String PROPERTY_SAMPLE_VRAC_WEIGHT = "sampleVracWeight";
+
+ public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
+
+ public static final String PROPERTY_ROWS = "rows";
+
+ public static final String PROPERTY_NEW_ROW = "newRow";
+
+ protected Float totalWeight;
+
+ protected Float totalVracWeight;
+
+ protected Float sampleVracWeight;
+
+ protected Float totalHorsVracWeight;
+
+ /**
+ * List of catches (linear representation).
+ *
+ * @since 0.2
+ */
+ protected List<SpeciesCatchEntryModel> rows;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public int getRowCount() {
+ return rows == null ? 0 : rows.size();
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getTotalVracWeight() {
+ return totalVracWeight;
+ }
+
+ public void setTotalVracWeight(Float totalVracWeight) {
+ Object oldValue = getTotalVracWeight();
+ this.totalVracWeight = totalVracWeight;
+ firePropertyChange(PROPERTY_TOTAL_VRAC_WEIGHT, oldValue, totalVracWeight);
+ }
+
+ public Float getSampleVracWeight() {
+ return sampleVracWeight;
+ }
+
+ public void setSampleVracWeight(Float sampleVracWeight) {
+ Object oldValue = getSampleVracWeight();
+ this.sampleVracWeight = sampleVracWeight;
+ firePropertyChange(PROPERTY_SAMPLE_VRAC_WEIGHT, oldValue, sampleVracWeight);
+ }
+
+ public Float getTotalHorsVracWeight() {
+ return totalHorsVracWeight;
+ }
+
+ public void setTotalHorsVracWeight(Float totalHorsVracWeight) {
+ Object oldValue = getTotalHorsVracWeight();
+ this.totalHorsVracWeight = totalHorsVracWeight;
+ firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight);
+ }
+
+ public List<SpeciesCatchEntryModel> getRows() {
+ return rows;
+ }
+
+ public void setCatches(List<SpeciesCatchEntryModel> rows) {
+ Object oldValue = getRowCount();
+ if (rows == null) {
+ rows = Lists.newArrayList();
+ }
+ this.rows = rows;
+ firePropertyChange(PROPERTY_ROWS, oldValue, rows);
+ }
+
+ public void addNewCatch() {
+ Preconditions.checkState(
+ rows != null,
+ "Cant add a row, rows list is null");
+ SpeciesCatchEntryModel newRow = new SpeciesCatchEntryModel();
+ if (log.isInfoEnabled()) {
+ log.info("Add a new catch ");
+ }
+ rows.add(newRow);
+ firePropertyChange(PROPERTY_NEW_ROW, null, newRow);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ SpeciesTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(SpeciesTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,209 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+import jaxx.runtime.SwingUtil;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesTableModel extends AbstractTableModel {
+
+ public static enum ColumnIdentifier {
+ speciesToConfirm,
+ speciesByCode("species"),
+ speciesByGenusCode("species"),
+ vracHorsVrac,
+ weightCategory,
+ sex,
+ maturity,
+ age,
+ weight,
+ computedWeight(null),
+ computedNumber(null),
+ sampleWeight,
+ elevationRatio,
+ comment,
+ file(null);
+
+ final String propertyName;
+
+ ColumnIdentifier() {
+ this("");
+ }
+
+ ColumnIdentifier(String propertyName) {
+ this.propertyName = "".equals(propertyName) ? name() : propertyName;
+ }
+
+ public void setValue(SpeciesCatchEntryModel entry, Object value) {
+ if (propertyName != null)
+ TuttiUIUtil.setProperty(entry, propertyName, value);
+ }
+
+ public Object getValue(SpeciesCatchEntryModel entry) {
+ Object result = null;
+ if (propertyName != null && entry != null) {
+ result = TuttiUIUtil.getProperty(entry, propertyName);
+ }
+ return result;
+ }
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ // TODO This will be dynamic by the protocol...
+ final Set<ColumnIdentifier> noneEditableCols = Sets.newHashSet(
+ ColumnIdentifier.age,
+ ColumnIdentifier.maturity,
+ ColumnIdentifier.computedWeight,
+ ColumnIdentifier.computedNumber,
+ ColumnIdentifier.sampleWeight,
+ ColumnIdentifier.elevationRatio,
+ ColumnIdentifier.file
+ );
+
+ protected final List<ColumnIdentifier> columnIdentifiers;
+
+ protected final TableColumn[] columns;
+
+ protected final SpeciesTabUIModel model;
+
+ public SpeciesTableModel(TableColumnModel columnModel,
+ SpeciesTabUIModel model) {
+ this.model = model;
+ int nbcols = columnModel.getColumnCount();
+ columns = new TableColumn[nbcols];
+ columnIdentifiers = Lists.newArrayList();
+ for (int i = 0; i < nbcols; i++) {
+ TableColumn column = columnModel.getColumn(i);
+ columns[i] = column;
+ columnIdentifiers.add((ColumnIdentifier) column.getIdentifier());
+ }
+ }
+
+ public void refreshData(List<SpeciesCatchEntryModel> data) {
+
+ // can't accept a empty data list
+ Preconditions.checkNotNull(data, "Data list can not be null.");
+
+ if (data.isEmpty()) {
+
+ // add a first edit line
+ data.add(new SpeciesCatchEntryModel());
+ }
+ fireTableDataChanged();
+ }
+
+ public void addNewRow(SpeciesCatchEntryModel newValue) {
+
+ List<SpeciesCatchEntryModel> data = getData();
+ Preconditions.checkNotNull(data, "Data list can not be null.");
+
+ int rowIndex = data.indexOf(newValue);
+ fireTableRowsInserted(rowIndex, rowIndex);
+ }
+
+ @Override
+ public int getRowCount() {
+ return model.getRowCount();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columns.length;
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ SpeciesCatchEntryModel entry = getEntry(rowIndex);
+ ColumnIdentifier propertyName = getPropertyName(columnIndex);
+ Object result = propertyName.getValue(entry);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
+ SpeciesCatchEntryModel entry = getEntry(rowIndex);
+ ColumnIdentifier propertyName = getPropertyName(columnIndex);
+ propertyName.setValue(entry, aValue);
+
+ if (propertyName == ColumnIdentifier.speciesByCode) {
+
+ // update also speciesByGenusCode column
+ int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByGenusCode);
+ fireTableCellUpdated(rowIndex, otherColumnIndex);
+ } else if (propertyName == ColumnIdentifier.speciesByGenusCode) {
+
+ // update also speciesByCode column
+ int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByCode);
+ fireTableCellUpdated(rowIndex, otherColumnIndex);
+ }
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ ColumnIdentifier identifier = getPropertyName(columnIndex);
+ boolean result = !noneEditableCols.contains(identifier);
+ return result;
+ }
+
+ public SpeciesCatchEntryModel getEntry(int rowIndex) {
+ SwingUtil.ensureRowIndex(this, rowIndex);
+ List<SpeciesCatchEntryModel> data = getData();
+ SpeciesCatchEntryModel result = data == null ? null : data.get(rowIndex);
+ return result;
+ }
+
+ protected TableColumn getColumn(int columnIndex) {
+ SwingUtil.ensureColumnIndex(this, columnIndex);
+ return columns[columnIndex];
+ }
+
+ protected ColumnIdentifier getPropertyName(int columnIndex) {
+ TableColumn column = getColumn(columnIndex);
+ return (ColumnIdentifier) column.getIdentifier();
+ }
+
+ protected int getColumnIndex(ColumnIdentifier property) {
+ int result = columnIdentifiers.indexOf(property);
+ return result;
+ }
+
+ protected List<SpeciesCatchEntryModel> getData() {
+ return model.getRows();
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,70 @@
+package fr.ifremer.tutti.ui.swing.util;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.jdesktop.swingx.decorator.AbstractHighlighter;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.util.PaintUtils;
+
+import javax.swing.JButton;
+import java.awt.Color;
+import java.awt.Component;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class TuttiColorHighlighter extends AbstractHighlighter {
+
+ protected Color color;
+
+ protected boolean foreground;
+
+ public TuttiColorHighlighter(HighlightPredicate predicate, Color color, boolean foreground) {
+ super(predicate);
+ this.color = color;
+ this.foreground = foreground;
+ }
+
+ @Override
+ protected Component doHighlight(Component component, ComponentAdapter adapter) {
+ if (component instanceof JButton) {
+ // do nothing
+
+ } else {
+ if (foreground) {
+ component.setForeground(color);
+
+ } else {
+ component.setBackground(color);
+ if (adapter.isSelected()) {
+ component.setForeground(PaintUtils.computeForeground(color));
+ }
+ }
+ }
+ return component;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-04 17:59:54 UTC (rev 27)
@@ -133,9 +133,11 @@
tutti.table.plancton.header.speciesByCode=Espèce
tutti.table.plancton.header.weight=Poids observé
tutti.table.species.header.age=Age
+tutti.table.species.header.comment=Commentaire
tutti.table.species.header.computedNumber=Nombre calculé
tutti.table.species.header.computedWeight=Poids calculé
tutti.table.species.header.elevationRate=Fraction d'él
+tutti.table.species.header.file=Pièces jointes
tutti.table.species.header.maturity=Maturité
tutti.table.species.header.sampleWeight=Poids échan
tutti.table.species.header.sex=Sexe
1
0
Author: tchemit
Date: 2012-12-04 18:59:17 +0100 (Tue, 04 Dec 2012)
New Revision: 26
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/26
Log:
optimize dependencies
Modified:
trunk/pom.xml
trunk/tutti-ui-swing/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-11-28 18:17:32 UTC (rev 25)
+++ trunk/pom.xml 2012-12-04 17:59:17 UTC (rev 26)
@@ -213,6 +213,12 @@
</dependency>
<dependency>
+ <groupId>org.swinglabs.swingx</groupId>
+ <artifactId>swingx-autocomplete</artifactId>
+ <version>${swingXVersion}</version>
+ </dependency>
+
+ <dependency>
<groupId>com.ezware.oxbow</groupId>
<artifactId>swing-bits</artifactId>
<version>0.5.0</version>
Modified: trunk/tutti-ui-swing/pom.xml
===================================================================
--- trunk/tutti-ui-swing/pom.xml 2012-11-28 18:17:32 UTC (rev 25)
+++ trunk/tutti-ui-swing/pom.xml 2012-12-04 17:59:17 UTC (rev 26)
@@ -274,6 +274,11 @@
<artifactId>swingx-common</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.swinglabs.swingx</groupId>
+ <artifactId>swingx-autocomplete</artifactId>
+ </dependency>
+
<!-- Logging -->
<dependency>
1
0