Tutti-commits
Threads by month
- ----- 2026 -----
- August
- July
- 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
r109 - in trunk: tutti-persistence/src/main/java/fr/ifremer/tutti/persistence tutti-persistence/src/main/xmi tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence tutti-service/src/main/java/fr/ifremer/tutti/service tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species
by tchemit@users.forge.codelutin.com Dec. 27, 2012
by tchemit@users.forge.codelutin.com Dec. 27, 2012
Dec. 27, 2012
Author: tchemit
Date: 2012-12-27 13:51:33 +0100 (Thu, 27 Dec 2012)
New Revision: 109
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/109
Log:
refs #1902: [Onglet Poisson] Ajout de la caract?\195?\169ristique du type de mesure
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/xmi/tutti-persistence.zargo
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIModel.java
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-27 06:39:32 UTC (rev 108)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-27 12:51:33 UTC (rev 109)
@@ -84,7 +84,7 @@
List<Caracteristic> getAllFishingOperationHydrologicCaracteristic();
- List<Caracteristic> getAllSpeciesFrequencyCaracteristic();
+ List<Caracteristic> getAllSpeciesLengthStepCaracteristic();
Caracteristic getSizeCategoryCaracteristic();
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-27 06:39:32 UTC (rev 108)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-27 12:51:33 UTC (rev 109)
@@ -268,7 +268,7 @@
}
@Override
- public List<Caracteristic> getAllSpeciesFrequencyCaracteristic() {
+ public List<Caracteristic> getAllSpeciesLengthStepCaracteristic() {
return getAllCaracteristicByCategory(CaracteristicEnum.SpeciesFrequency.name());
}
@@ -660,22 +660,22 @@
// index them by id
Map<String, B> existingById = TuttiEntities.splitById(existingData);
- for (B toSave : newData) {
+ for (B source : newData) {
- B saved;
+ B target;
- if (TuttiEntities.isNew(toSave)) {
+ if (TuttiEntities.isNew(source)) {
// must create it
- saved = TuttiEntities.newEntity(beanType);
+ target = TuttiEntities.newEntity(beanType);
} else {
// get existing data
- saved = existingById.get(toSave.getId());
+ target = existingById.get(source.getId());
}
// store it to be persist in one time
- toPersist.put(toSave, saved);
+ toPersist.put(target, source);
}
// persist (entry with a value) and dettach (entry with no value)
@@ -683,12 +683,12 @@
List<B> result = Lists.newArrayList();
for (Map.Entry<B, B> entry : toPersist.entrySet()) {
- B source = entry.getKey();
- B target = entry.getValue();
- if (target == null) {
+ B source = entry.getValue();
+ B target = entry.getKey();
+ if (source == null) {
// dettach entity
- cache.remove(beanType, source);
+ cache.remove(beanType, target);
} else {
// persist entity
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-27 06:39:32 UTC (rev 108)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-27 12:51:33 UTC (rev 109)
@@ -203,9 +203,9 @@
}
@Override
- public List<Caracteristic> getAllSpeciesFrequencyCaracteristic() {
+ public List<Caracteristic> getAllSpeciesLengthStepCaracteristic() {
checkDriverExists();
- return driver.getAllSpeciesFrequencyCaracteristic();
+ return driver.getAllSpeciesLengthStepCaracteristic();
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java 2012-12-27 06:39:32 UTC (rev 108)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java 2012-12-27 12:51:33 UTC (rev 109)
@@ -357,9 +357,9 @@
}
public void setFrequency(List<SpeciesFrequencyRowModel> frequency) {
- Object oldValue = getFrequency();
this.frequency = frequency;
- firePropertyChange(PROPERTY_FREQUENCY, oldValue, frequency);
+ // force to propagate frequencies changes
+ firePropertyChange(PROPERTY_FREQUENCY, null, frequency);
}
public Float getComputedWeight() {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2012-12-27 06:39:32 UTC (rev 108)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2012-12-27 12:51:33 UTC (rev 109)
@@ -137,8 +137,7 @@
protected String[] getRowPropertiesToIgnore() {
return new String[]{
SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
- SpeciesBatchRowModel.PROPERTY_FREQUENCY};
+ SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO};
}
@Override
@@ -172,7 +171,6 @@
addComboDataColumnToModel(columnModel,
SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
decorator, allSpecies);
-
}
{
@@ -188,10 +186,8 @@
data.getQualitativeValue());
}
- {
+ { // SizeCategory column
- // SizeCategory column
-
Caracteristic data =
persistenceService.getSizeCategoryCaracteristic();
@@ -201,10 +197,8 @@
data.getQualitativeValue());
}
- {
+ { // SexCategory column
- // SexCategory column
-
Caracteristic data = persistenceService.getSexCaracteristic();
addComboDataColumnToModel(columnModel,
@@ -213,10 +207,8 @@
data.getQualitativeValue());
}
- {
+ { // MaturityCategory column
- // MaturityCategory column
-
Caracteristic data =
persistenceService.getMaturityCaracteristic();
@@ -304,6 +296,9 @@
Object oldValue,
Object newValue) {
+ if (log.isInfoEnabled()) {
+ log.info("Property " + propertyName + " has changed on row.");
+ }
if (RECOMPUTE_TOTAL_WEIGHT.contains(propertyName)) {
// Need to recompute totalHorsVracWeight
@@ -561,7 +556,7 @@
PersistenceService service =
context.getService(PersistenceService.class);
List<Caracteristic> lengthCaracterics =
- service.getAllSpeciesFrequencyCaracteristic();
+ service.getAllSpeciesLengthStepCaracteristic();
ui.setContextValue(lengthCaracterics, SPECIES_FREQUENCY_LENGHTS);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyRowModel.java 2012-12-27 06:39:32 UTC (rev 108)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyRowModel.java 2012-12-27 12:51:33 UTC (rev 109)
@@ -28,6 +28,7 @@
import com.google.common.collect.Ordering;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -52,6 +53,10 @@
public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight";
+
+ public static final String PROPERTY_LENGHT_STEP_CARACTERISTIC = "lengthStepCaracteristic";
+
+
/**
* Length step.
*
@@ -80,6 +85,13 @@
*/
protected Float computedWeight;
+ /**
+ * Length step caracteristic.
+ *
+ * @since 0.3
+ */
+ protected Caracteristic lengthStepCaracteristic;
+
protected static final Binder<SpeciesBatchFrequency, SpeciesFrequencyRowModel> fromBeanBinder =
BinderFactory.newBinder(SpeciesBatchFrequency.class,
SpeciesFrequencyRowModel.class);
@@ -155,10 +167,20 @@
firePropertyChange(PROPERTY_COMPUTED_WEIGHT, oldValue, computedWeight);
}
+ public Caracteristic getLengthStepCaracteristic() {
+ return lengthStepCaracteristic;
+ }
+
+ public void setLengthStepCaracteristic(Caracteristic lengthStepCaracteristic) {
+ Object oldValue = getLengthStepCaracteristic();
+ this.lengthStepCaracteristic = lengthStepCaracteristic;
+ firePropertyChange(PROPERTY_LENGHT_STEP_CARACTERISTIC, oldValue, lengthStepCaracteristic);
+ }
+
//TODO Use validator
@Override
public boolean isValid() {
- return lengthStep != null && number != null;
+ return lengthStep != null && number != null && lengthStepCaracteristic != null;
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyTableModel.java 2012-12-27 06:39:32 UTC (rev 108)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyTableModel.java 2012-12-27 12:51:33 UTC (rev 109)
@@ -130,6 +130,8 @@
Preconditions.checkNotNull(newValue, "can't add a null row");
+ newValue.setLengthStepCaracteristic(uiModel.getLengthStepCaracteristic());
+
// add new row to cache
Float lengthStep = newValue.getLengthStep();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.css 2012-12-27 06:39:32 UTC (rev 108)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.css 2012-12-27 12:51:33 UTC (rev 109)
@@ -148,6 +148,7 @@
actionIcon: "close";
text: "tutti.action.close";
mnemonic: F;
+ enabled: {model.getRows().size() == 0 || model.getLengthStepCaracteristic() != null};
}
#table {
@@ -155,4 +156,5 @@
selectionBackground: {null};
selectionForeground: {Color.BLACK};
sortable: false;
+ enabled: {model.getLengthStepCaracteristic() != null}
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIHandler.java 2012-12-27 06:39:32 UTC (rev 108)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIHandler.java 2012-12-27 12:51:33 UTC (rev 109)
@@ -44,6 +44,8 @@
import java.awt.Color;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -173,6 +175,7 @@
SpeciesFrequencyUIModel model = getModel();
+ //TODO Use protocol to have lengthStepCaracteristic to use (if any protocol)
initBeanComboBox(ui.getLenghtStepCaracteristicComboBox(),
lengthStepCaracterics,
model.getLengthStepCaracteristic());
@@ -223,6 +226,17 @@
}
}
});
+
+ // when lengthStepCaracteristic changed, let's updates all row with the new value
+ model.addPropertyChangeListener(SpeciesFrequencyUIModel.PROPERTY_LENGHT_STEP_CARACTERISTIC, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Caracteristic newValue = (Caracteristic) evt.getNewValue();
+ for (SpeciesFrequencyRowModel rowModel : getModel().getRows()) {
+ rowModel.setLengthStepCaracteristic(newValue);
+ }
+ }
+ });
}
@Override
@@ -306,10 +320,13 @@
public void editBatch(SpeciesBatchRowModel row) {
List<SpeciesFrequencyRowModel> frequency = null;
+
+ Caracteristic lengthStepCaracteristic = null;
if (row != null) {
frequency = row.getFrequency();
}
+
List<SpeciesFrequencyRowModel> editFrequency;
if (CollectionUtils.isEmpty(frequency)) {
@@ -318,16 +335,38 @@
} else {
editFrequency = Lists.newArrayList(frequency);
+ lengthStepCaracteristic = frequency.get(0).getLengthStepCaracteristic();
}
if (log.isInfoEnabled()) {
log.info("Will edit batch row: " + row + " with " +
editFrequency.size() + " frequency");
}
- getModel().setRows(editFrequency);
+ SpeciesFrequencyUIModel model = getModel();
+
+ model.setRows(editFrequency);
+
+ if (lengthStepCaracteristic == null) {
+
+ // no lengthStep caracteristic to apply make sure it is not setted.
+ if (log.isInfoEnabled()) {
+ log.info("No lengthStepCaracteristic to set.");
+ }
+ model.setLengthStepCaracteristic(null);
+ } else {
+
+ // apply existing lengthStepCaracteristic
+
+ if (log.isInfoEnabled()) {
+ log.info("Use lengthStepCaracteristic: " +
+ lengthStepCaracteristic.getName());
+ }
+ model.setLengthStepCaracteristic(lengthStepCaracteristic);
+ }
+
// keep batch (will be used to push back editing entry)
- getModel().setBatch(row);
+ model.setBatch(row);
}
public void close() {
@@ -336,10 +375,11 @@
log.info("Will close UI " + ui);
}
+ SpeciesFrequencyUIModel model = getModel();
+
// transfer rows to editor
-
List<SpeciesFrequencyRowModel> frequency = Lists.newArrayList();
- for (SpeciesFrequencyRowModel row : getModel().getRows()) {
+ for (SpeciesFrequencyRowModel row : model.getRows()) {
if (row.isValid()) {
// can keep this row
@@ -349,11 +389,11 @@
if (log.isInfoEnabled()) {
log.info("Push back " + frequency.size() +
- " frequency to batch " + getModel().getBatch());
+ " frequency to batch " + model.getBatch());
}
// push back to batch
- getModel().getBatch().setFrequency(frequency);
+ model.getBatch().setFrequency(frequency);
ui.editBatch(null);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIModel.java 2012-12-27 06:39:32 UTC (rev 108)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIModel.java 2012-12-27 12:51:33 UTC (rev 109)
@@ -94,6 +94,11 @@
*/
protected Float maxStep;
+ /**
+ * Length step caracteristic.
+ *
+ * @since 0.3
+ */
protected Caracteristic lengthStepCaracteristic;
public SpeciesFrequencyUIModel() {
1
0
r108 - in trunk: tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species tutti-ui-swing/src/main/resources/i18n
by tchemit@users.forge.codelutin.com Dec. 27, 2012
by tchemit@users.forge.codelutin.com Dec. 27, 2012
Dec. 27, 2012
Author: tchemit
Date: 2012-12-27 07:39:32 +0100 (Thu, 27 Dec 2012)
New Revision: 108
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/108
Log:
fixes #1902: [Onglet Poisson] Ajout de la caract?\195?\169ristique du type de mesure
Modified:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIModel.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
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-21 21:48:13 UTC (rev 107)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-12-27 06:39:32 UTC (rev 108)
@@ -37,7 +37,6 @@
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
-import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@@ -303,7 +302,23 @@
createNumberCaracteristic("Average Bottom Salinity",
CaracteristicEnum.FishingOperationHydrologic.name());
+ createNumberCaracteristic("Mesure au cm par un observateur (carapace)",
+ CaracteristicEnum.SpeciesFrequency.name());
+ createNumberCaracteristic("Mesure au cm par un observateur (totale)",
+ CaracteristicEnum.SpeciesFrequency.name());
+
+ createNumberCaracteristic("Mesure au cm par un observateur (céphalothorax)",
+ CaracteristicEnum.SpeciesFrequency.name());
+ createNumberCaracteristic("Mesure au 1/2 cm par un observateur (totale)",
+ CaracteristicEnum.SpeciesFrequency.name());
+ createNumberCaracteristic("Mesure au 1/100 mm par un observateur (queue de langoustine)",
+ CaracteristicEnum.SpeciesFrequency.name());
+ createNumberCaracteristic("Mesure au 1/2 cm par un observateur (manteau)",
+ CaracteristicEnum.SpeciesFrequency.name());
+ createNumberCaracteristic("Mesure au cm par un observateur (manteau)",
+ CaracteristicEnum.SpeciesFrequency.name());
+
Species sp;
sp = new Species();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2012-12-21 21:48:13 UTC (rev 107)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2012-12-27 06:39:32 UTC (rev 108)
@@ -77,8 +77,7 @@
component='speciesTotalUnsortedWeightField'/>
</BeanValidator>
- <SpeciesFrequencyUI id='frequencyEditor'
- constructorParams='handler.getContext()'/>
+ <SpeciesFrequencyUI id='frequencyEditor' constructorParams='this'/>
<LongTextEditorUI id='longTextEditor'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2012-12-21 21:48:13 UTC (rev 107)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2012-12-27 06:39:32 UTC (rev 108)
@@ -36,6 +36,7 @@
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
@@ -422,7 +423,7 @@
showInformationMessage(
"[ Captures - Espèces ] " +
- "Sauvegarde des modifications de " + decorate(bean) +
+ "Sauvegarde des modifications de " + bean +
".");
saveRow(bean);
@@ -462,6 +463,8 @@
SpeciesBatch catchBean = row.toBean();
FishingOperation fishingOperation = getModel().getFishingOperation();
+ Preconditions.checkNotNull(fishingOperation);
+
catchBean.setFishingOperation(fishingOperation);
if (log.isInfoEnabled()) {
log.info("Selected fishingOperation: " + fishingOperation.getId());
@@ -540,6 +543,8 @@
//-- AbstractTuttiUIHandler methods --//
//------------------------------------------------------------------------//
+ public static final String SPECIES_FREQUENCY_LENGHTS = "SPECIES_FREQUENCY_LENGHTS";
+
@Override
public void beforeInitUI() {
@@ -552,6 +557,12 @@
SpeciesBatchUIModel model = new SpeciesBatchUIModel(catchesUIModel);
ui.setContextValue(model);
+
+ PersistenceService service =
+ context.getService(PersistenceService.class);
+ List<Caracteristic> lengthCaracterics =
+ service.getAllSpeciesFrequencyCaracteristic();
+ ui.setContextValue(lengthCaracterics, SPECIES_FREQUENCY_LENGHTS);
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.css 2012-12-21 21:48:13 UTC (rev 107)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.css 2012-12-27 06:39:32 UTC (rev 108)
@@ -22,6 +22,12 @@
* #L%
*/
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
NumberEditor {
autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
@@ -40,6 +46,16 @@
bean: {model};
}
+#lenghtStepCaracteristicLabel {
+ text: "tutti.label.frequencyConfiguration.lengthStepCaracteristic";
+ labelFor: {lenghtStepCaracteristicComboBox};
+}
+
+#lenghtStepCaracteristicComboBox {
+ property: "lengthStepCaracteristic";
+ selectedItem: {model.getLengthStepCaracteristic()};
+}
+
#minStepLabel {
text: "tutti.label.frequencyConfiguration.minStep";
labelFor: {minStepField};
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.jaxx 2012-12-21 21:48:13 UTC (rev 107)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.jaxx 2012-12-27 06:39:32 UTC (rev 108)
@@ -25,6 +25,8 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesFrequencyUIModel, SpeciesFrequencyUIHandler>'>
<import>
+ fr.ifremer.tutti.persistence.entities.referential.Caracteristic
+
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel
@@ -46,8 +48,9 @@
<script><![CDATA[
- public SpeciesFrequencyUI(TuttiUIContext context) {
- SpeciesFrequencyUIHandler handler = new SpeciesFrequencyUIHandler(context, this);
+ public SpeciesFrequencyUI(SpeciesBatchUI parentUI) {
+ JAXXUtil.initContext(this, parentUI);
+ SpeciesFrequencyUIHandler handler = new SpeciesFrequencyUIHandler(parentUI.getHandler().getContext(), this);
setContextValue(handler);
handler.beforeInitUI();
}
@@ -70,7 +73,8 @@
<CardLayout2Ext id='modeConfigurationLayout'
constructorParams='this, "modeConfigurationPanel"'/>
- <JPanel id='configurationPanel' layout='{new BorderLayout()}' constraints='BorderLayout.NORTH'>
+ <JPanel id='configurationPanel' layout='{new BorderLayout()}'
+ constraints='BorderLayout.NORTH'>
<JPanel layout='{new BorderLayout()}' constraints='BorderLayout.CENTER'>
<VBox id='modePanel' constraints='BorderLayout.WEST'
@@ -142,6 +146,17 @@
<JSeparator/>
</cell>
</row>
+ <!-- length step caracteristic -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='lenghtStepCaracteristicLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <BeanComboBox id='lenghtStepCaracteristicComboBox'
+ constructorParams='this'
+ genericType='Caracteristic'/>
+ </cell>
+ </row>
<!-- Step -->
<row>
<cell anchor='west'>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIHandler.java 2012-12-21 21:48:13 UTC (rev 107)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIHandler.java 2012-12-27 06:39:32 UTC (rev 108)
@@ -24,7 +24,9 @@
* #L%
*/
+import com.ezware.oxbow.swingbits.util.Preconditions;
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
@@ -163,13 +165,23 @@
initUI(ui);
+ List<Caracteristic> lengthStepCaracterics =
+ ui.getContextValue(
+ List.class,
+ SpeciesBatchUIHandler.SPECIES_FREQUENCY_LENGHTS);
+ Preconditions.checkNotNull(lengthStepCaracterics);
+
+ SpeciesFrequencyUIModel model = getModel();
+
+ initBeanComboBox(ui.getLenghtStepCaracteristicComboBox(),
+ lengthStepCaracterics,
+ model.getLengthStepCaracteristic());
+
JXTable table = getTable();
// create table column model
TableColumnModel columnModel = createTableColumnModel();
- SpeciesFrequencyUIModel model = getModel();
-
// create table model
SpeciesFrequencyTableModel tableModel =
new SpeciesFrequencyTableModel(columnModel, model);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIModel.java 2012-12-21 21:48:13 UTC (rev 107)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIModel.java 2012-12-27 06:39:32 UTC (rev 108)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
/**
@@ -50,6 +51,8 @@
public static final String PROPERTY_RAFALE_MODE = "rafaleMode";
+ public static final String PROPERTY_LENGHT_STEP_CARACTERISTIC = "lengthStepCaracteristic";
+
public static enum ConfigurationMode {
SIMPLE,
AUTO_GEN,
@@ -91,6 +94,8 @@
*/
protected Float maxStep;
+ protected Caracteristic lengthStepCaracteristic;
+
public SpeciesFrequencyUIModel() {
super(SpeciesBatchRowModel.class, null, null);
}
@@ -118,6 +123,16 @@
firePropertyChange(PROPERTY_STEP, oldValue, step);
}
+ public Caracteristic getLengthStepCaracteristic() {
+ return lengthStepCaracteristic;
+ }
+
+ public void setLengthStepCaracteristic(Caracteristic lengthStepCaracteristic) {
+ Object oldValue = getLengthStepCaracteristic();
+ this.lengthStepCaracteristic = lengthStepCaracteristic;
+ firePropertyChange(PROPERTY_LENGHT_STEP_CARACTERISTIC, oldValue, lengthStepCaracteristic);
+ }
+
public Float getMinStep() {
return minStep;
}
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-21 21:48:13 UTC (rev 107)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-27 06:39:32 UTC (rev 108)
@@ -111,6 +111,7 @@
tutti.label.fishingOperation.subStrata=Sous strate
tutti.label.fishingOperation.systemeFermetureCul=Système de fermeture de cul
tutti.label.fishingOperation.windDirection=Direction du vent
+tutti.label.frequencyConfiguration.lengthStepCaracteristic=Type de mesure
tutti.label.frequencyConfiguration.maxStep=Classe max
tutti.label.frequencyConfiguration.minStep=Classe min
tutti.label.frequencyConfiguration.mode.autoGen=Génération des classes
1
0
r107 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing: . content/operation content/operation/catches content/operation/catches/species util util/table
by tchemit@users.forge.codelutin.com Dec. 21, 2012
by tchemit@users.forge.codelutin.com Dec. 21, 2012
Dec. 21, 2012
Author: tchemit
Date: 2012-12-21 22:48:13 +0100 (Fri, 21 Dec 2012)
New Revision: 107
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/107
Log:
add message listener
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/UIMessageNotifier.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/TuttiUIContext.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/CaracteristicRow.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-21 20:52:54 UTC (rev 106)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-21 21:48:13 UTC (rev 107)
@@ -32,6 +32,7 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.UIMessageNotifier;
import fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor;
import jaxx.runtime.swing.editor.NumberEditor;
import jaxx.runtime.swing.editor.bean.BeanComboBox;
@@ -68,7 +69,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public abstract class AbstractTuttiUIHandler<M> {
+public abstract class AbstractTuttiUIHandler<M> implements UIMessageNotifier {
/** Logger. */
private static final Log log =
@@ -88,6 +89,11 @@
this.context = context;
}
+ @Override
+ public void showInformationMessage(String message) {
+ context.showInformationMessage(message);
+ }
+
public TuttiUIContext getContext() {
return context;
}
@@ -288,6 +294,10 @@
return decorator;
}
+ protected String decorate(Object object) {
+ return getDecorator(object.getClass(), null).toString(object);
+ }
+
protected <O> ListCellRenderer newListCellRender(Class<O> type) {
return newListCellRender(type, null);
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-21 20:52:54 UTC (rev 106)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-21 21:48:13 UTC (rev 107)
@@ -75,6 +75,7 @@
super(context);
this.ui = ui;
this.persistenceService = context.getService(PersistenceService.class);
+ context.addMessageNotifier(this);
}
@Override
@@ -308,6 +309,11 @@
}
}
+ @Override
+ public final void showInformationMessage(String message) {
+ ui.getStatus().setStatus(message);
+ }
+
protected void setScreen(TuttiScreen screen) {
try {
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-21 20:52:54 UTC (rev 106)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-21 21:48:13 UTC (rev 107)
@@ -33,6 +33,7 @@
import fr.ifremer.tutti.service.TuttiService;
import fr.ifremer.tutti.service.TuttiServiceContext;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
+import fr.ifremer.tutti.ui.swing.util.UIMessageNotifier;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -51,7 +52,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class TuttiUIContext extends AbstractBean implements Closeable {
+public class TuttiUIContext extends AbstractBean implements Closeable, UIMessageNotifier {
/** Logger. */
private static final Log log = LogFactory.getLog(TuttiUIContext.class);
@@ -128,6 +129,13 @@
*/
protected TuttiScreen screen;
+ /**
+ * Message notifiers.
+ *
+ * @since 0.3
+ */
+ protected final Set<UIMessageNotifier> messageNotifiers;
+
public static TuttiUIContext newContext(TuttiConfig config) {
Preconditions.checkNotNull(config);
Preconditions.checkState(applicationContext == null,
@@ -140,6 +148,17 @@
this.config = config;
this.serviceContext = new TuttiServiceContext(config.getServiceConfig());
this.swingSession = new SwingSession(getConfig().getUIConfigFile(), false);
+ UIMessageNotifier logMessageNotifier = new UIMessageNotifier() {
+
+ @Override
+ public void showInformationMessage(String message) {
+ if (log.isInfoEnabled()) {
+ log.info(message);
+ }
+ }
+ };
+ this.messageNotifiers = Sets.newHashSet();
+ addMessageNotifier(logMessageNotifier);
}
public <S extends TuttiService> S getService(Class<S> serviceType) {
@@ -323,8 +342,11 @@
public void close() {
// Clear data references
+ messageNotifiers.clear();
+
programId = null;
cruiseId = null;
+ protocolId = null;
IOUtils.closeQuietly(serviceContext);
@@ -348,4 +370,15 @@
config.setProtocolId(protocolId);
config.save();
}
+
+ public void addMessageNotifier(UIMessageNotifier messageNotifier) {
+ this.messageNotifiers.add(messageNotifier);
+ }
+
+ @Override
+ public void showInformationMessage(String message) {
+ for (UIMessageNotifier messageNotifier : messageNotifiers) {
+ messageNotifier.showInformationMessage(message);
+ }
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-21 20:52:54 UTC (rev 106)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-21 21:48:13 UTC (rev 107)
@@ -314,14 +314,21 @@
// save modified fishing operation
FishingOperation toSave = beanToSave.toBean();
+ showInformationMessage(
+ "[ Trait - Caractéristiques générales ] " +
+ "Sauvegarde des modifications de " + decorate(toSave) +
+ ".");
+
if (log.isInfoEnabled()) {
log.info("FishingOperation " + toSave.getId() +
" was modified, will save it.");
}
fishingOperationMonitor.clearModified();
+
// persist current fishingOperation
- parentUi.getHandler().saveFishingOperation(toSave);
+ persistenceService.saveFishingOperation(toSave);
+ //parentUi.getHandler().saveFishingOperation(toSave);
}
}
@@ -341,7 +348,7 @@
model.fromBean(bean);
// to be sure saisisseurs are updated
- model.setSaisisseur(Lists.newArrayList(bean.getSaisisseur()));
+// model.setSaisisseur(Lists.newArrayList(bean.getSaisisseur()));
// to be sure combo list will be reloaded
model.setStrata(null);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2012-12-21 20:52:54 UTC (rev 106)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2012-12-21 21:48:13 UTC (rev 107)
@@ -125,6 +125,11 @@
" was modified, will save it.");
}
+ showInformationMessage(
+ "[ Captures - Caractéristiques générales ] " +
+ "Sauvegarde des modifications de " + decorate(fishingOperation) +
+ ".");
+
persistenceService.saveFishingOperation(fishingOperation);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2012-12-21 20:52:54 UTC (rev 106)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2012-12-21 21:48:13 UTC (rev 107)
@@ -420,6 +420,11 @@
log.info("Row " + bean + " was modified, will save it");
}
+ showInformationMessage(
+ "[ Captures - Espèces ] " +
+ "Sauvegarde des modifications de " + decorate(bean) +
+ ".");
+
saveRow(bean);
// clear modified flag on the monitor
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/UIMessageNotifier.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/UIMessageNotifier.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/UIMessageNotifier.java 2012-12-21 21:48:13 UTC (rev 107)
@@ -0,0 +1,36 @@
+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%
+ */
+
+/**
+ * To notify somemessage in ui.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public interface UIMessageNotifier {
+
+ void showInformationMessage(String message);
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/UIMessageNotifier.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/CaracteristicRow.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/CaracteristicRow.java 2012-12-21 20:52:54 UTC (rev 106)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/CaracteristicRow.java 2012-12-21 21:48:13 UTC (rev 107)
@@ -1,5 +1,29 @@
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 fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
/**
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/CaracteristicRow.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r106 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation
by tchemit@users.forge.codelutin.com Dec. 21, 2012
by tchemit@users.forge.codelutin.com Dec. 21, 2012
Dec. 21, 2012
Author: tchemit
Date: 2012-12-21 21:52:54 +0100 (Fri, 21 Dec 2012)
New Revision: 106
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/106
Log:
move barches to correct package
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/
1
0
Dec. 21, 2012
Author: tchemit
Date: 2012-12-21 21:51:46 +0100 (Fri, 21 Dec 2012)
New Revision: 105
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/105
Log:
move barches to correct package
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/FrequencyCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTreeModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTreeNode.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIModel.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.java
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -319,6 +319,7 @@
" was modified, will save it.");
}
+ fishingOperationMonitor.clearModified();
// persist current fishingOperation
parentUi.getHandler().saveFishingOperation(toSave);
}
@@ -339,6 +340,9 @@
model.fromBean(bean);
+ // to be sure saisisseurs are updated
+ model.setSaisisseur(Lists.newArrayList(bean.getSaisisseur()));
+
// to be sure combo list will be reloaded
model.setStrata(null);
model.setSubStrata(null);
@@ -361,7 +365,7 @@
// update saisissuer selection
List<Person> saisisseur = model.getSaisisseur();
if (log.isInfoEnabled()) {
- log.info("Selected saisisseurs: " + saisisseur.size());
+ log.info("Selected saisisseurs: " + (saisisseur == null ? 0 : saisisseur.size()));
}
ui.getSaisisseurList().getModel().setSelected(saisisseur);
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchRowModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchRowModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,138 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.accidental;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
-import fr.ifremer.tutti.persistence.entities.data.Attachment;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * Define a benthos batch row.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class AccidentalBatchRowModel extends AbstractTuttiBeanUIModel<AccidentalBatch, AccidentalBatchRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_SPECIES = "species";
-
- public static final String PROPERTY_WEIGHT = "weight";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_ATTACHMENTS = "attachments";
-
- /**
- * Species observed.
- *
- * @since 0.2
- */
- protected Species species;
-
- /**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- /**
- * Comment on this catches.
- *
- * @since 0.2
- */
- protected String comment;
-
- /**
- * Attachments
- *
- * @since 0.2
- */
- protected List<Attachment> attachments;
-
- protected static final Binder<AccidentalBatch, AccidentalBatchRowModel> fromBeanBinder =
- BinderFactory.newBinder(AccidentalBatch.class,
- AccidentalBatchRowModel.class);
-
- protected static final Binder<AccidentalBatchRowModel, AccidentalBatch> toBeanBinder =
- BinderFactory.newBinder(AccidentalBatchRowModel.class,
- AccidentalBatch.class);
-
- public AccidentalBatchRowModel() {
- super(AccidentalBatch.class, fromBeanBinder, toBeanBinder);
- }
-
- public AccidentalBatchRowModel(AccidentalBatch aBatch) {
- this();
- fromBean(aBatch);
- }
-
- public Species getSpecies() {
- return species;
- }
-
- public void setSpecies(Species species) {
- Object oldValue = getSpecies();
- this.species = species;
- firePropertyChange(PROPERTY_SPECIES, oldValue, species);
- }
-
- public Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- Object oldValue = getWeight();
- this.weight = weight;
- firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public List<Attachment> getAttachments() {
- return attachments;
- }
-
- public void setAttachments(List<Attachment> attachments) {
- Object oldValue = getAttachments();
- this.attachments = attachments;
- firePropertyChange(PROPERTY_ATTACHMENTS, oldValue, attachments);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchTableModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchTableModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,115 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.accidental;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.operation.benthos.BenthosBatchRowModel;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-
-import javax.swing.table.TableColumnModel;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class AccidentalBatchTableModel extends AbstractTuttiTableModel<AccidentalBatchRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final ColumnIdentifier<AccidentalBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
- BenthosBatchRowModel.PROPERTY_SPECIES,
- n_("tutti.table.accidental.batch.header.speciesByCode"),
- n_("tutti.table.accidental.batch.header.speciesByCode"));
-
- public static final ColumnIdentifier<AccidentalBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
- BenthosBatchRowModel.PROPERTY_SPECIES,
- n_("tutti.table.accidental.batch.header.speciesByGenusCode"),
- n_("tutti.table.accidental.batch.header.speciesByGenusCode"));
-
- public static final ColumnIdentifier<AccidentalBatchRowModel> WEIGHT = ColumnIdentifier.newId(
- BenthosBatchRowModel.PROPERTY_WEIGHT,
- n_("tutti.table.accidental.batch.header.weight"),
- n_("tutti.table.accidental.batch.header.weight"));
-
- public static final ColumnIdentifier<AccidentalBatchRowModel> COMMENT = ColumnIdentifier.newId(
- BenthosBatchRowModel.PROPERTY_COMMENT,
- n_("tutti.table.accidental.batch.header.comment"),
- n_("tutti.table.accidental.batch.header.comment"));
-
- public static final ColumnIdentifier<AccidentalBatchRowModel> ATTACHMENTS = ColumnIdentifier.newId(
- AccidentalBatchRowModel.PROPERTY_ATTACHMENTS,
- n_("tutti.table.accidental.batch.header.file"),
- n_("tutti.table.accidental.batch.header.file"));
-
-
- public AccidentalBatchTableModel(TableColumnModel columnModel) {
- super(columnModel);
-
- setNoneEditableCols();
- }
-
- @Override
- protected AccidentalBatchRowModel createNewRow() {
- AccidentalBatchRowModel result = new AccidentalBatchRowModel();
-
- // by default empty row is not valid
- result.setValid(false);
- return result;
- }
-
- @Override
- public void setValueAt(Object aValue,
- int rowIndex,
- int columnIndex,
- ColumnIdentifier<AccidentalBatchRowModel> propertyName,
- AccidentalBatchRowModel entry) {
- super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
-
- if (propertyName == SPECIES_BY_CODE) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex, SPECIES_BY_GENUS_CODE);
-
- } else if (propertyName == SPECIES_BY_GENUS_CODE) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex, SPECIES_BY_CODE);
- }
- }
-
- @Override
- protected boolean isCellEditable(int rowIndex,
- int columnIndex,
- ColumnIdentifier<AccidentalBatchRowModel> propertyName) {
-
- boolean result = super.isCellEditable(rowIndex,
- columnIndex,
- propertyName);
-
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.css 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.css 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,37 +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;
-}
-
-#table {
- selectionMode: {ListSelectionModel.SINGLE_SELECTION};
- selectionBackground: {null};
- selectionForeground: {Color.BLACK};
- sortable: false;
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,71 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<JPanel id='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<AccidentalBatchUIModel, AccidentalBatchUIHandler>'>
-
- <import>
- fr.ifremer.tutti.ui.swing.TuttiUI
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
- fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
-
- jaxx.runtime.swing.editor.NumberEditor
-
- org.jdesktop.swingx.JXTable
-
- javax.swing.ListSelectionModel
-
- java.awt.Color
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public AccidentalBatchUI(TuttiUI<?,?> parentUI) {
- JAXXUtil.initContext(this, parentUI);
- AccidentalBatchUIHandler handler = new AccidentalBatchUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <AccidentalBatchUIHandler id='handler'
- initializer='getContextValue(AccidentalBatchUIHandler.class)'/>
-
- <AccidentalBatchUIModel id='model'
- initializer='getContextValue(AccidentalBatchUIModel.class)'/>
-
- <LongTextEditorUI id='longTextEditor'/>
-
- <AttachmentEditorUI id='attachmentEditor'/>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event)'/>
- </JScrollPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,368 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.accidental;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
-import fr.ifremer.tutti.persistence.entities.data.Attachment;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.ui.swing.TuttiUI;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
-import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
-import org.nuiton.util.decorator.Decorator;
-
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class AccidentalBatchUIHandler extends AbstractTuttiBatchTableUIHandler<AccidentalBatchRowModel, AccidentalBatchUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(AccidentalBatchUIHandler.class);
-
- /**
- * UI.
- *
- * @since 0.2
- */
- private final AccidentalBatchUI ui;
-
- public AccidentalBatchUIHandler(TuttiUI<?, ?> parentUi,
- AccidentalBatchUI ui) {
- super(parentUi,
- AccidentalBatchRowModel.PROPERTY_SPECIES,
- AccidentalBatchRowModel.PROPERTY_WEIGHT,
- AccidentalBatchRowModel.PROPERTY_COMMENT);
- this.ui = ui;
- }
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiTableUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- protected AccidentalBatchUIModel getModel() {
- return ui.getModel();
- }
-
- @Override
- protected AccidentalBatchTableModel getTableModel() {
- return (AccidentalBatchTableModel) getTable().getModel();
- }
-
- @Override
- protected JXTable getTable() {
- return ui.getTable();
- }
-
- @Override
- protected FishingOperation getFishingOperation() {
- return getModel().getFishingOperation();
- }
-
- @Override
- protected TableColumnModel createTableColumnModel() {
-
- DefaultTableColumnModelExt columnModel =
- new DefaultTableColumnModelExt();
-
- List<Species> allSpecies = persistenceService.getAllSpecies();
-
- {
- // Species (by code) column
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_CODE);
-
- addComboDataColumnToModel(columnModel,
- AccidentalBatchTableModel.SPECIES_BY_CODE,
- decorator, allSpecies);
- }
-
- {
- // Species (by genusCode) column
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_GENUS);
-
- addComboDataColumnToModel(columnModel,
- AccidentalBatchTableModel.SPECIES_BY_GENUS_CODE,
- decorator, allSpecies);
-
- }
-
- { // Weight column
-
- addFloatColumnToModel(columnModel,
- AccidentalBatchTableModel.WEIGHT,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Comment column
-
- addColumnToModel(columnModel,
- LongTextCellComponent.newEditor(ui.getLongTextEditor()),
- LongTextCellComponent.newRender(n_("tutti.tooltip.comment.none")),
- AccidentalBatchTableModel.COMMENT);
- }
-
- { // File column
-
- addColumnToModel(columnModel,
- AttachmentCellComponent.newEditor(ui.getAttachmentEditor()),
- AttachmentCellComponent.newRender(
- getDecorator(Attachment.class, null),
- n_("tutti.tooltip.attachment.none")),
- AccidentalBatchTableModel.ATTACHMENTS);
- }
- return columnModel;
- }
-
- @Override
- protected void onRowModified(AccidentalBatchRowModel row,
- String propertyName,
- Object oldValue,
- Object newValue) {
-
- boolean wasValid = row.isValid();
-
- boolean valid = isRowValid(row);
-
- if (log.isInfoEnabled()) {
- log.info("Was valid / Is valid: " + wasValid + " / " + valid);
- }
- row.setValid(valid);
- }
-
- @Override
- protected void onRowValidStateChanged(AccidentalBatchRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- int rowIndex = getTableModel().getRowIndex(row);
-
- if (rowIndex > -1) {
- getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
- }
- }
-
- @Override
- protected void onRowModifyStateChanged(AccidentalBatchRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- }
-
- @Override
- protected void onModelRowsChanged(List<AccidentalBatchRowModel> rows) {
- super.onModelRowsChanged(rows);
-
- // set valid flag
- for (AccidentalBatchRowModel row : rows) {
- boolean valid = isRowValid(row);
- row.setValid(valid);
- }
- }
-
- @Override
- protected void saveSelectedRowIfRequired() {
-
- TuttiBeanMonitor<AccidentalBatchRowModel> rowMonitor = getRowMonitor();
-
- AccidentalBatchRowModel bean = rowMonitor.getBean();
- if (bean != null) {
-
- if (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();
- }
- } else {
-
- // row is not valid can not save it
-
- AccidentalBatch catchBean = bean.toBean();
-
- if (!TuttiEntities.isNew(catchBean)) {
-
- // remove this
- persistenceService.deleteAccidentalBatch(catchBean.getId());
- }
- }
- }
- }
-
- @Override
- protected boolean isRowValid(AccidentalBatchRowModel row) {
- boolean result = row.getSpecies() != null && row.getWeight() != null;
- return result;
- }
-
- @Override
- protected void saveRow(AccidentalBatchRowModel row) {
-
- AccidentalBatch catchBean = row.toBean();
-
- FishingOperation fishingOperation = getModel().getFishingOperation();
- catchBean.setFishingOperation(fishingOperation);
- if (log.isInfoEnabled()) {
- log.info("Selected fishingOperation: " + fishingOperation.getId());
- }
-
- if (TuttiEntities.isNew(catchBean)) {
-
- catchBean = persistenceService.createAccidentalBatch(catchBean);
- row.setId(catchBean.getId());
- } else {
- persistenceService.saveAccidentalBatch(catchBean);
- }
- }
-
- @Override
- public void selectFishingOperation(FishingOperation bean) {
-
- JXTable table = getTable();
-
- if (table.isEditing()) {
-
- // make sure to stop editor
- table.editingCanceled(null);
- }
-
- // make sure selection is empty (will remove bean from monitor)
- table.clearSelection();
-
- boolean empty = bean == null;
-
- AccidentalBatchUIModel model = getModel();
-
- List<AccidentalBatchRowModel> rows;
-
- if (empty) {
- rows = null;
- } else {
-
- if (log.isInfoEnabled()) {
- log.info("Get accidental batch for fishingOperation: " +
- bean.getId());
- }
- rows = Lists.newArrayList();
-
- if (!TuttiEntities.isNew(bean)) {
- List<AccidentalBatch> catches =
- persistenceService.getAllAccidentalBatch(bean.getId());
- for (AccidentalBatch aBatch : catches) {
- AccidentalBatchRowModel entry =
- new AccidentalBatchRowModel(aBatch);
- rows.add(entry);
- }
- }
-
- }
- model.setRows(rows);
- }
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- public void beforeInitUI() {
-
- if (log.isInfoEnabled()) {
- log.info("beforeInit: " + ui);
- }
-
- EditCatchesUIModel catchesUIModel =
- ui.getContextValue(EditCatchesUIModel.class);
-
- AccidentalBatchUIModel model = new AccidentalBatchUIModel(catchesUIModel);
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- if (log.isInfoEnabled()) {
- log.info("afterInit: " + ui);
- }
-
- initUI(ui);
-
- JXTable table = getTable();
-
- // create table column model
- TableColumnModel columnModel = createTableColumnModel();
-
- // create table model
- AccidentalBatchTableModel tableModel =
- new AccidentalBatchTableModel(columnModel);
-
- table.setModel(tableModel);
- table.setColumnModel(columnModel);
-
- initBatchTable(table, columnModel, tableModel);
- }
-
- @Override
- public void onCloseUI() {
- if (log.isInfoEnabled()) {
- log.info("closing: " + ui);
- }
- }
-
- //------------------------------------------------------------------------//
- //-- Public methods --//
- //------------------------------------------------------------------------//
-
- //------------------------------------------------------------------------//
- //-- Internal methods --//
- //------------------------------------------------------------------------//
-
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,42 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.accidental;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class AccidentalBatchUIModel extends AbstractTuttiBatchUIModel<AccidentalBatchRowModel, AccidentalBatchUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public AccidentalBatchUIModel(EditCatchesUIModel catchesUIModel) {
- super(catchesUIModel);
- }
-
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchRowModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchRowModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,196 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.benthos;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.Attachment;
-import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * Define a benthos batch row.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, BenthosBatchRowModel> {
-
- 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_WEIGHT = "weight";
-
- public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
-
- public static final String PROPERTY_SAMPLING_RATIO = "samplingRatio";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_ATTACHMENTS = "attachments";
-
- /**
- * Species observed.
- *
- * @since 0.2
- */
- protected Species species;
-
- /**
- * Is the species need to be confirmed?.
- *
- * @since 0.2
- */
- protected boolean speciesToConfirm;
-
- /**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- /**
- * Sample weight.
- *
- * @since 0.2
- */
- protected Float sampleWeight;
-
- /**
- * Sampling ratio.
- *
- * @since 0.2
- */
- protected Float samplingRatio;
-
- /**
- * Comment on this catches.
- *
- * @since 0.2
- */
- protected String comment;
-
- /**
- * Attachments
- *
- * @since 0.2
- */
- protected List<Attachment> attachments;
-
- protected static final Binder<BenthosBatch, BenthosBatchRowModel> fromBeanBinder =
- BinderFactory.newBinder(BenthosBatch.class,
- BenthosBatchRowModel.class);
-
- protected static final Binder<BenthosBatchRowModel, BenthosBatch> toBeanBinder =
- BinderFactory.newBinder(BenthosBatchRowModel.class,
- BenthosBatch.class);
-
- public BenthosBatchRowModel() {
- super(BenthosBatch.class, fromBeanBinder, toBeanBinder);
- }
-
- public BenthosBatchRowModel(BenthosBatch aBatch) {
- this();
- fromBean(aBatch);
- }
-
- 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 Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- Object oldValue = getWeight();
- this.weight = weight;
- firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
- }
-
- public Float getSampleWeight() {
- return sampleWeight;
- }
-
- public void setSampleWeight(Float sampleWeight) {
- Object oldValue = getSampleWeight();
- this.sampleWeight = sampleWeight;
- firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
- }
-
- public Float getSamplingRatio() {
- return samplingRatio;
- }
-
- public void setSamplingRatio(Float samplingRatio) {
- Object oldValue = getSamplingRatio();
- this.samplingRatio = samplingRatio;
- firePropertyChange(PROPERTY_SAMPLING_RATIO, oldValue, samplingRatio);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public List<Attachment> getAttachments() {
- return attachments;
- }
-
- public void setAttachments(List<Attachment> attachments) {
- Object oldValue = getAttachments();
- this.attachments = attachments;
- firePropertyChange(PROPERTY_ATTACHMENTS, oldValue, attachments);
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,143 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.benthos;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchRowModel;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-
-import javax.swing.table.TableColumnModel;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BenthosBatchTableModel extends AbstractTuttiTableModel<BenthosBatchRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
- BenthosBatchRowModel.PROPERTY_SPECIES,
- n_("tutti.table.benthos.batch.header.speciesByCode"),
- n_("tutti.table.benthos.batch.header.speciesByCode"));
-
- public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
- BenthosBatchRowModel.PROPERTY_SPECIES,
- n_("tutti.table.benthos.batch.header.speciesByGenusCode"),
- n_("tutti.table.benthos.batch.header.speciesByGenusCode"));
-
- public static final ColumnIdentifier<BenthosBatchRowModel> WEIGHT = ColumnIdentifier.newId(
- BenthosBatchRowModel.PROPERTY_WEIGHT,
- n_("tutti.table.benthos.batch.header.weight"),
- n_("tutti.table.benthos.batch.header.weight"));
-
- public static final ColumnIdentifier<BenthosBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
- BenthosBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- n_("tutti.table.benthos.batch.header.sampleWeight"),
- n_("tutti.table.benthos.batch.header.sampleWeight"));
-
- public static final ColumnIdentifier<BenthosBatchRowModel> SAMPLING_RATIO = ColumnIdentifier.newId(
- BenthosBatchRowModel.PROPERTY_SAMPLING_RATIO,
- n_("tutti.table.benthos.batch.header.samplingRatio"),
- n_("tutti.table.benthos.batch.header.samplingRatio"));
-
- public static final ColumnIdentifier<BenthosBatchRowModel> COMMENT = ColumnIdentifier.newId(
- BenthosBatchRowModel.PROPERTY_COMMENT,
- n_("tutti.table.benthos.batch.header.comment"),
- n_("tutti.table.benthos.batch.header.comment"));
-
- public static final ColumnIdentifier<BenthosBatchRowModel> ATTACHMENTS = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_ATTACHMENTS,
- n_("tutti.table.benthos.batch.header.file"),
- n_("tutti.table.benthos.batch.header.file"));
-
- public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
- BenthosBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
- n_("tutti.table.benthos.batch.header.toConfirm"),
- n_("tutti.table.benthos.batch.header.toConfirm"));
-
- public BenthosBatchTableModel(TableColumnModel columnModel) {
- super(columnModel);
-
- setNoneEditableCols(SAMPLE_WEIGHT, SAMPLING_RATIO);
- }
-
- @Override
- protected BenthosBatchRowModel createNewRow() {
- BenthosBatchRowModel result = new BenthosBatchRowModel();
-
- // by default empty row is not valid
- result.setValid(false);
- return result;
- }
-
- @Override
- public void setValueAt(Object aValue,
- int rowIndex,
- int columnIndex,
- ColumnIdentifier<BenthosBatchRowModel> propertyName,
- BenthosBatchRowModel entry) {
- super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
-
- if (propertyName == SPECIES_BY_CODE) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex,
- SPECIES_BY_GENUS_CODE);
-
- } else if (propertyName == SPECIES_BY_GENUS_CODE) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex,
- SPECIES_BY_CODE);
- }
- }
-
- public void updateSamplingRatio(Set<BenthosBatchRowModel> rows) {
- for (BenthosBatchRowModel row : rows) {
- int rowIndex = getRows().indexOf(row);
- fireTableCellUpdated(rowIndex,
- SAMPLE_WEIGHT,
- SAMPLING_RATIO);
- }
-
-
- }
-
- @Override
- protected boolean isCellEditable(int rowIndex,
- int columnIndex,
- ColumnIdentifier<BenthosBatchRowModel> propertyName) {
-
- boolean result = super.isCellEditable(rowIndex,
- columnIndex,
- propertyName);
-
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css 2012-12-21 20:51:46 UTC (rev 105)
@@ -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;
-}
-
-#benthosTotalWeightLabel {
- text: "tutti.label.catches.benthosTotalWeight";
- labelFor: {benthosTotalWeightField};
-}
-
-#benthosTotalWeightField {
- property: "benthosTotalWeight";
- model: {model.getBenthosTotalWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#benthosTotalSortedWeightLabel {
- text: "tutti.label.catches.benthosTotalSortedWeight";
- labelFor: {benthosTotalSortedWeightField};
-}
-
-#benthosTotalSortedWeightField {
- property: "benthosTotalSortedWeight";
- model: {model.getBenthosTotalSortedWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#benthosTotalSampleSortedWeightLabel {
- text: "tutti.label.catches.benthosTotalSampleSortedWeight";
- labelFor: {benthosTotalSampleSortedWeightField};
-}
-
-#benthosTotalSampleSortedWeightField {
- property: "benthosTotalSampleSortedWeight";
- model: {model.getBenthosTotalSampleSortedWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#benthosTotalUnsortedWeightLabel {
- text: "tutti.label.catches.benthosTotalUnsortedWeight";
- labelFor: {benthosTotalUnsortedWeightField};
-}
-
-#benthosTotalUnsortedWeightField {
- text: {getStringValue(model.getBenthosTotalUnsortedWeight())};
- editable: false;
-}
-
-#table {
- selectionMode: {ListSelectionModel.SINGLE_SELECTION};
- selectionBackground: {null};
- selectionForeground: {Color.BLACK};
- sortable: false;
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,126 +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<BenthosBatchUIModel, BenthosBatchUIHandler>'>
-
- <import>
- fr.ifremer.tutti.ui.swing.TuttiUI
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
- fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- org.jdesktop.swingx.JXTable
-
- javax.swing.ListSelectionModel
-
- java.awt.Color
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
- </import>
-
- <script><![CDATA[
-
-public BenthosBatchUI(TuttiUI<?,?> parentUI) {
- JAXXUtil.initContext(this, parentUI);
- BenthosBatchUIHandler handler = new BenthosBatchUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <BenthosBatchUIHandler id='handler'
- initializer='getContextValue(BenthosBatchUIHandler.class)'/>
-
- <BenthosBatchUIModel id='model'
- initializer='getContextValue(BenthosBatchUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='benthosTotalWeight' component='benthosTotalWeightField'/>
- <field name='benthosTotalSortedWeight'
- component='benthosTotalSortedWeightField'/>
- <field name='benthosTotalSampleSortedWeight'
- component='benthosTotalSampleSortedWeightField'/>
- <field name='benthosTotalUnsortedWeight'
- component='benthosTotalUnsortedWeightField'/>
- </BeanValidator>
-
- <LongTextEditorUI id='longTextEditor'/>
-
- <AttachmentEditorUI id='attachmentEditor'/>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total / Poids total vrac -->
- <row>
- <cell anchor='west'>
- <JLabel id='benthosTotalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='benthosTotalWeightField' constructorParams='this'/>
- </cell>
- <cell anchor='west'>
- <JLabel id='benthosTotalSortedWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='benthosTotalSortedWeightField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids échantillonné vrac / Poids total hors vrac -->
- <row>
- <cell>
- <JLabel id='benthosTotalSampleSortedWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='benthosTotalSampleSortedWeightField'
- constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='benthosTotalUnsortedWeightLabel'/>
- </cell>
- <cell>
- <JTextField id='benthosTotalUnsortedWeightField'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JXTable id='table'
- onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
- </JScrollPane>
-
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,400 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.benthos;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.Attachment;
-import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.ui.swing.TuttiUI;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
-import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
-import org.nuiton.util.decorator.Decorator;
-
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<BenthosBatchRowModel, BenthosBatchUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(BenthosBatchUIHandler.class);
-
- /**
- * UI.
- *
- * @since 0.2
- */
- private final BenthosBatchUI ui;
-
- public BenthosBatchUIHandler(TuttiUI<?, ?> parentUi,
- BenthosBatchUI ui) {
- super(parentUi,
- BenthosBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
- BenthosBatchRowModel.PROPERTY_SPECIES,
- BenthosBatchRowModel.PROPERTY_WEIGHT,
- BenthosBatchRowModel.PROPERTY_COMMENT);
- this.ui = ui;
-
- }
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiTableUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- protected BenthosBatchUIModel getModel() {
- return ui.getModel();
- }
-
- @Override
- protected BenthosBatchTableModel getTableModel() {
- return (BenthosBatchTableModel) getTable().getModel();
- }
-
- @Override
- protected JXTable getTable() {
- return ui.getTable();
- }
-
- @Override
- protected FishingOperation getFishingOperation() {
- return getModel().getFishingOperation();
- }
-
- @Override
- protected String[] getRowPropertiesToIgnore() {
- return new String[]{
- BenthosBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- BenthosBatchRowModel.PROPERTY_SAMPLING_RATIO
- };
- }
-
- @Override
- protected TableColumnModel createTableColumnModel() {
-
- DefaultTableColumnModelExt columnModel =
- new DefaultTableColumnModelExt();
-
- List<Species> allSpecies = persistenceService.getAllSpecies();
-
- {
- // Species (by code) column
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_CODE);
-
- addComboDataColumnToModel(columnModel,
- BenthosBatchTableModel.SPECIES_BY_CODE,
- decorator, allSpecies);
- }
-
- {
- // Species (by genusCode) column
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_GENUS);
-
- addComboDataColumnToModel(columnModel,
- BenthosBatchTableModel.SPECIES_BY_GENUS_CODE,
- decorator, allSpecies);
-
- }
-
- { // Weight column
-
- addFloatColumnToModel(columnModel,
- BenthosBatchTableModel.WEIGHT,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Sample weight column
-
- addColumnToModel(columnModel,
- BenthosBatchTableModel.SAMPLE_WEIGHT);
- }
-
- { // SamplingRatio column
-
- addColumnToModel(columnModel,
- BenthosBatchTableModel.SAMPLING_RATIO);
- }
-
- { // Comment column
-
- addColumnToModel(columnModel,
- LongTextCellComponent.newEditor(ui.getLongTextEditor()),
- LongTextCellComponent.newRender(n_("tutti.tooltip.comment.none")),
- BenthosBatchTableModel.COMMENT);
- }
-
- { // File column
-
- addColumnToModel(columnModel,
- AttachmentCellComponent.newEditor(ui.getAttachmentEditor()),
- AttachmentCellComponent.newRender(
- getDecorator(Attachment.class, null),
- n_("tutti.tooltip.attachment.none")),
- BenthosBatchTableModel.ATTACHMENTS);
- }
-
- { // Species to confirm column
-
- addBooleanColumnToModel(columnModel,
- BenthosBatchTableModel.SPECIES_TO_CONFIRM,
- getTable());
- }
- return columnModel;
- }
-
- @Override
- protected void onRowModified(BenthosBatchRowModel row,
- String propertyName,
- Object oldValue,
- Object newValue) {
-
- boolean wasValid = row.isValid();
-
- boolean valid = isRowValid(row);
-
- if (log.isInfoEnabled()) {
- log.info("Was valid / Is valid: " + wasValid + " / " + valid);
- }
- row.setValid(valid);
- }
-
- @Override
- protected void onRowValidStateChanged(BenthosBatchRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- int rowIndex = getTableModel().getRowIndex(row);
-
- if (rowIndex > -1) {
- getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
- }
- }
-
- @Override
- protected void onRowModifyStateChanged(BenthosBatchRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- }
-
- @Override
- protected void onModelRowsChanged(List<BenthosBatchRowModel> rows) {
- super.onModelRowsChanged(rows);
-
- // set valid flag
- for (BenthosBatchRowModel row : rows) {
- boolean valid = isRowValid(row);
- row.setValid(valid);
- }
- }
-
- @Override
- protected void saveSelectedRowIfRequired() {
-
- TuttiBeanMonitor<BenthosBatchRowModel> rowMonitor = getRowMonitor();
-
- BenthosBatchRowModel bean = rowMonitor.getBean();
- if (bean != null) {
-
- if (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();
- }
- } else {
-
- // row is not valid can not save it
-
- BenthosBatch catchBean = bean.toBean();
-
- if (!TuttiEntities.isNew(catchBean)) {
-
- // remove this
- persistenceService.deleteBenthosBatch(catchBean.getId());
- }
- }
- }
- }
-
- @Override
- protected boolean isRowValid(BenthosBatchRowModel row) {
- boolean result = row.getSpecies() != null && row.getWeight() != null;
- return result;
- }
-
- @Override
- protected void saveRow(BenthosBatchRowModel row) {
-
- BenthosBatch catchBean = row.toBean();
-
- FishingOperation fishingOperation = getModel().getFishingOperation();
- catchBean.setFishingOperation(fishingOperation);
- if (log.isInfoEnabled()) {
- log.info("Selected fishingOperation: " + fishingOperation.getId());
- }
-
- if (TuttiEntities.isNew(catchBean)) {
-
- catchBean = persistenceService.createBenthosBatch(catchBean);
- row.setId(catchBean.getId());
- } else {
- persistenceService.saveBenthosBatch(catchBean);
- }
- }
-
- @Override
- public void selectFishingOperation(FishingOperation bean) {
-
- JXTable table = getTable();
-
- if (table.isEditing()) {
-
- // make sure to stop editor
- table.editingCanceled(null);
- }
-
- // make sure selection is empty (will remove bean from monitor)
- table.clearSelection();
-
- boolean empty = bean == null;
-
- BenthosBatchUIModel model = getModel();
-
- List<BenthosBatchRowModel> rows;
-
- if (empty) {
- rows = null;
- } else {
-
- if (log.isInfoEnabled()) {
- log.info("Get species batch for fishingOperation: " +
- bean.getId());
- }
- rows = Lists.newArrayList();
-
- if (!TuttiEntities.isNew(bean)) {
- List<BenthosBatch> catches =
- persistenceService.getAllBenthosBatch(bean.getId());
- for (BenthosBatch aBatch : catches) {
- BenthosBatchRowModel entry =
- new BenthosBatchRowModel(aBatch);
- rows.add(entry);
- }
- }
- }
-
- model.setRows(rows);
- }
-
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- public void beforeInitUI() {
-
- if (log.isInfoEnabled()) {
- log.info("beforeInit: " + ui);
- }
-
- EditCatchesUIModel catchesUIModel =
- ui.getContextValue(EditCatchesUIModel.class);
-
- BenthosBatchUIModel model = new BenthosBatchUIModel(catchesUIModel);
- ui.setContextValue(model);
-
-// fishingOperationMonitor.setBean(model);
- }
-
- @Override
- public void afterInitUI() {
-
- if (log.isInfoEnabled()) {
- log.info("afterInit: " + ui);
- }
-
- initUI(ui);
-
- JXTable table = getTable();
-
- // create table column model
- TableColumnModel columnModel = createTableColumnModel();
-
- // create table model
- BenthosBatchTableModel tableModel =
- new BenthosBatchTableModel(columnModel);
-
- table.setModel(tableModel);
- table.setColumnModel(columnModel);
-
- initBatchTable(table, columnModel, tableModel);
- }
-
- @Override
- public void onCloseUI() {
- if (log.isInfoEnabled()) {
- log.info("closing: " + ui);
- }
- }
-
- //------------------------------------------------------------------------//
- //-- Public methods --//
- //------------------------------------------------------------------------//
-
- //------------------------------------------------------------------------//
- //-- Internal methods --//
- //------------------------------------------------------------------------//
-
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,77 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.benthos;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BenthosBatchUIModel extends AbstractTuttiBatchUIModel<BenthosBatchRowModel, BenthosBatchUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public BenthosBatchUIModel(EditCatchesUIModel catchesUIModel) {
- super(catchesUIModel,
- EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_WEIGHT,
- EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_UNSORTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_WEIGHT);
- }
-
- public Float getBenthosTotalWeight() {
- return catchesUIModel.getBenthosTotalWeight();
- }
-
- public void setBenthosTotalWeight(Float benthosTotalWeight) {
- catchesUIModel.setBenthosTotalWeight(benthosTotalWeight);
- }
-
- public Float getBenthosTotalSampleSortedWeight() {
- return catchesUIModel.getBenthosTotalSampleSortedWeight();
- }
-
- public void setBenthosTotalSampleSortedWeight(Float benthosTotalSampleSortedWeight) {
- catchesUIModel.setBenthosTotalSampleSortedWeight(benthosTotalSampleSortedWeight);
- }
-
- public Float getBenthosTotalSortedWeight() {
- return catchesUIModel.getBenthosTotalSortedWeight();
- }
-
- public void setBenthosTotalSortedWeight(Float benthosTotalSortedWeight) {
- catchesUIModel.setBenthosTotalSortedWeight(benthosTotalSortedWeight);
- }
-
- public Float getBenthosTotalUnsortedWeight() {
- return catchesUIModel.getBenthosTotalUnsortedWeight();
- }
-
- public void setBenthosTotalUnsortedWeight(Float benthosTotalUnsortedWeight) {
- catchesUIModel.setBenthosTotalUnsortedWeight(benthosTotalUnsortedWeight);
- }
-}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2012-12-21 20:51:46 UTC (rev 105)
@@ -26,11 +26,11 @@
<import>
fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
- fr.ifremer.tutti.ui.swing.content.operation.accidental.AccidentalBatchUI
- fr.ifremer.tutti.ui.swing.content.operation.benthos.BenthosBatchUI
- fr.ifremer.tutti.ui.swing.content.operation.macrowaste.MacroWasteBatchUI
- fr.ifremer.tutti.ui.swing.content.operation.plankton.PlanktonBatchUI
- fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.catches.macrowaste.MacroWasteBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.catches.plankton.PlanktonBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI
fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI
org.jdesktop.swingx.JXTitledPanel
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,138 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.accidental;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
+import fr.ifremer.tutti.persistence.entities.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * Define a benthos batch row.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentalBatchRowModel extends AbstractTuttiBeanUIModel<AccidentalBatch, AccidentalBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_SPECIES = "species";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_ATTACHMENTS = "attachments";
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected Species species;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ /**
+ * Attachments
+ *
+ * @since 0.2
+ */
+ protected List<Attachment> attachments;
+
+ protected static final Binder<AccidentalBatch, AccidentalBatchRowModel> fromBeanBinder =
+ BinderFactory.newBinder(AccidentalBatch.class,
+ AccidentalBatchRowModel.class);
+
+ protected static final Binder<AccidentalBatchRowModel, AccidentalBatch> toBeanBinder =
+ BinderFactory.newBinder(AccidentalBatchRowModel.class,
+ AccidentalBatch.class);
+
+ public AccidentalBatchRowModel() {
+ super(AccidentalBatch.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public AccidentalBatchRowModel(AccidentalBatch aBatch) {
+ this();
+ fromBean(aBatch);
+ }
+
+ public Species getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(Species species) {
+ Object oldValue = getSpecies();
+ this.species = species;
+ firePropertyChange(PROPERTY_SPECIES, oldValue, species);
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public List<Attachment> getAttachments() {
+ return attachments;
+ }
+
+ public void setAttachments(List<Attachment> attachments) {
+ Object oldValue = getAttachments();
+ this.attachments = attachments;
+ firePropertyChange(PROPERTY_ATTACHMENTS, oldValue, attachments);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchTableModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchTableModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,115 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.accidental;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentalBatchTableModel extends AbstractTuttiTableModel<AccidentalBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<AccidentalBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.accidental.batch.header.speciesByCode"),
+ n_("tutti.table.accidental.batch.header.speciesByCode"));
+
+ public static final ColumnIdentifier<AccidentalBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.accidental.batch.header.speciesByGenusCode"),
+ n_("tutti.table.accidental.batch.header.speciesByGenusCode"));
+
+ public static final ColumnIdentifier<AccidentalBatchRowModel> WEIGHT = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.accidental.batch.header.weight"),
+ n_("tutti.table.accidental.batch.header.weight"));
+
+ public static final ColumnIdentifier<AccidentalBatchRowModel> COMMENT = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_COMMENT,
+ n_("tutti.table.accidental.batch.header.comment"),
+ n_("tutti.table.accidental.batch.header.comment"));
+
+ public static final ColumnIdentifier<AccidentalBatchRowModel> ATTACHMENTS = ColumnIdentifier.newId(
+ AccidentalBatchRowModel.PROPERTY_ATTACHMENTS,
+ n_("tutti.table.accidental.batch.header.file"),
+ n_("tutti.table.accidental.batch.header.file"));
+
+
+ public AccidentalBatchTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols();
+ }
+
+ @Override
+ protected AccidentalBatchRowModel createNewRow() {
+ AccidentalBatchRowModel result = new AccidentalBatchRowModel();
+
+ // by default empty row is not valid
+ result.setValid(false);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<AccidentalBatchRowModel> propertyName,
+ AccidentalBatchRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+
+ if (propertyName == SPECIES_BY_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex, SPECIES_BY_GENUS_CODE);
+
+ } else if (propertyName == SPECIES_BY_GENUS_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex, SPECIES_BY_CODE);
+ }
+ }
+
+ @Override
+ protected boolean isCellEditable(int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<AccidentalBatchRowModel> propertyName) {
+
+ boolean result = super.isCellEditable(rowIndex,
+ columnIndex,
+ propertyName);
+
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.css (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.css 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,37 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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;
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.jaxx (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.jaxx 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,71 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a 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<AccidentalBatchUIModel, AccidentalBatchUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.ui.swing.TuttiUI
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
+ fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ org.jdesktop.swingx.JXTable
+
+ javax.swing.ListSelectionModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public AccidentalBatchUI(TuttiUI<?,?> parentUI) {
+ JAXXUtil.initContext(this, parentUI);
+ AccidentalBatchUIHandler handler = new AccidentalBatchUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <AccidentalBatchUIHandler id='handler'
+ initializer='getContextValue(AccidentalBatchUIHandler.class)'/>
+
+ <AccidentalBatchUIModel id='model'
+ initializer='getContextValue(AccidentalBatchUIModel.class)'/>
+
+ <LongTextEditorUI id='longTextEditor'/>
+
+ <AttachmentEditorUI id='attachmentEditor'/>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event)'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,368 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.accidental;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
+import fr.ifremer.tutti.persistence.entities.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
+import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentalBatchUIHandler extends AbstractTuttiBatchTableUIHandler<AccidentalBatchRowModel, AccidentalBatchUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(AccidentalBatchUIHandler.class);
+
+ /**
+ * UI.
+ *
+ * @since 0.2
+ */
+ private final AccidentalBatchUI ui;
+
+ public AccidentalBatchUIHandler(TuttiUI<?, ?> parentUi,
+ AccidentalBatchUI ui) {
+ super(parentUi,
+ AccidentalBatchRowModel.PROPERTY_SPECIES,
+ AccidentalBatchRowModel.PROPERTY_WEIGHT,
+ AccidentalBatchRowModel.PROPERTY_COMMENT);
+ this.ui = ui;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ protected AccidentalBatchUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ protected AccidentalBatchTableModel getTableModel() {
+ return (AccidentalBatchTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected FishingOperation getFishingOperation() {
+ return getModel().getFishingOperation();
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+
+ {
+ // Species (by code) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
+
+ addComboDataColumnToModel(columnModel,
+ AccidentalBatchTableModel.SPECIES_BY_CODE,
+ decorator, allSpecies);
+ }
+
+ {
+ // Species (by genusCode) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addComboDataColumnToModel(columnModel,
+ AccidentalBatchTableModel.SPECIES_BY_GENUS_CODE,
+ decorator, allSpecies);
+
+ }
+
+ { // Weight column
+
+ addFloatColumnToModel(columnModel,
+ AccidentalBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Comment column
+
+ addColumnToModel(columnModel,
+ LongTextCellComponent.newEditor(ui.getLongTextEditor()),
+ LongTextCellComponent.newRender(n_("tutti.tooltip.comment.none")),
+ AccidentalBatchTableModel.COMMENT);
+ }
+
+ { // File column
+
+ addColumnToModel(columnModel,
+ AttachmentCellComponent.newEditor(ui.getAttachmentEditor()),
+ AttachmentCellComponent.newRender(
+ getDecorator(Attachment.class, null),
+ n_("tutti.tooltip.attachment.none")),
+ AccidentalBatchTableModel.ATTACHMENTS);
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(AccidentalBatchRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+
+ boolean wasValid = row.isValid();
+
+ boolean valid = isRowValid(row);
+
+ if (log.isInfoEnabled()) {
+ log.info("Was valid / Is valid: " + wasValid + " / " + valid);
+ }
+ row.setValid(valid);
+ }
+
+ @Override
+ protected void onRowValidStateChanged(AccidentalBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ int rowIndex = getTableModel().getRowIndex(row);
+
+ if (rowIndex > -1) {
+ getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
+ }
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(AccidentalBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
+ @Override
+ protected void onModelRowsChanged(List<AccidentalBatchRowModel> rows) {
+ super.onModelRowsChanged(rows);
+
+ // set valid flag
+ for (AccidentalBatchRowModel row : rows) {
+ boolean valid = isRowValid(row);
+ row.setValid(valid);
+ }
+ }
+
+ @Override
+ protected void saveSelectedRowIfRequired() {
+
+ TuttiBeanMonitor<AccidentalBatchRowModel> rowMonitor = getRowMonitor();
+
+ AccidentalBatchRowModel bean = rowMonitor.getBean();
+ if (bean != null) {
+
+ if (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();
+ }
+ } else {
+
+ // row is not valid can not save it
+
+ AccidentalBatch catchBean = bean.toBean();
+
+ if (!TuttiEntities.isNew(catchBean)) {
+
+ // remove this
+ persistenceService.deleteAccidentalBatch(catchBean.getId());
+ }
+ }
+ }
+ }
+
+ @Override
+ protected boolean isRowValid(AccidentalBatchRowModel row) {
+ boolean result = row.getSpecies() != null && row.getWeight() != null;
+ return result;
+ }
+
+ @Override
+ protected void saveRow(AccidentalBatchRowModel row) {
+
+ AccidentalBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
+ }
+
+ if (TuttiEntities.isNew(catchBean)) {
+
+ catchBean = persistenceService.createAccidentalBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.saveAccidentalBatch(catchBean);
+ }
+ }
+
+ @Override
+ public void selectFishingOperation(FishingOperation bean) {
+
+ JXTable table = getTable();
+
+ if (table.isEditing()) {
+
+ // make sure to stop editor
+ table.editingCanceled(null);
+ }
+
+ // make sure selection is empty (will remove bean from monitor)
+ table.clearSelection();
+
+ boolean empty = bean == null;
+
+ AccidentalBatchUIModel model = getModel();
+
+ List<AccidentalBatchRowModel> rows;
+
+ if (empty) {
+ rows = null;
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Get accidental batch for fishingOperation: " +
+ bean.getId());
+ }
+ rows = Lists.newArrayList();
+
+ if (!TuttiEntities.isNew(bean)) {
+ List<AccidentalBatch> catches =
+ persistenceService.getAllAccidentalBatch(bean.getId());
+ for (AccidentalBatch aBatch : catches) {
+ AccidentalBatchRowModel entry =
+ new AccidentalBatchRowModel(aBatch);
+ rows.add(entry);
+ }
+ }
+
+ }
+ model.setRows(rows);
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public void beforeInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("beforeInit: " + ui);
+ }
+
+ EditCatchesUIModel catchesUIModel =
+ ui.getContextValue(EditCatchesUIModel.class);
+
+ AccidentalBatchUIModel model = new AccidentalBatchUIModel(catchesUIModel);
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("afterInit: " + ui);
+ }
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ AccidentalBatchTableModel tableModel =
+ new AccidentalBatchTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ initBatchTable(table, columnModel, tableModel);
+ }
+
+ @Override
+ public void onCloseUI() {
+ if (log.isInfoEnabled()) {
+ log.info("closing: " + ui);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,42 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.accidental;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentalBatchUIModel extends AbstractTuttiBatchUIModel<AccidentalBatchRowModel, AccidentalBatchUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public AccidentalBatchUIModel(EditCatchesUIModel catchesUIModel) {
+ super(catchesUIModel);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,196 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * Define a benthos batch row.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, BenthosBatchRowModel> {
+
+ 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_WEIGHT = "weight";
+
+ public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
+
+ public static final String PROPERTY_SAMPLING_RATIO = "samplingRatio";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_ATTACHMENTS = "attachments";
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected Species species;
+
+ /**
+ * Is the species need to be confirmed?.
+ *
+ * @since 0.2
+ */
+ protected boolean speciesToConfirm;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Sample weight.
+ *
+ * @since 0.2
+ */
+ protected Float sampleWeight;
+
+ /**
+ * Sampling ratio.
+ *
+ * @since 0.2
+ */
+ protected Float samplingRatio;
+
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ /**
+ * Attachments
+ *
+ * @since 0.2
+ */
+ protected List<Attachment> attachments;
+
+ protected static final Binder<BenthosBatch, BenthosBatchRowModel> fromBeanBinder =
+ BinderFactory.newBinder(BenthosBatch.class,
+ BenthosBatchRowModel.class);
+
+ protected static final Binder<BenthosBatchRowModel, BenthosBatch> toBeanBinder =
+ BinderFactory.newBinder(BenthosBatchRowModel.class,
+ BenthosBatch.class);
+
+ public BenthosBatchRowModel() {
+ super(BenthosBatch.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public BenthosBatchRowModel(BenthosBatch aBatch) {
+ this();
+ fromBean(aBatch);
+ }
+
+ 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 Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public Float getSampleWeight() {
+ return sampleWeight;
+ }
+
+ public void setSampleWeight(Float sampleWeight) {
+ Object oldValue = getSampleWeight();
+ this.sampleWeight = sampleWeight;
+ firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
+ }
+
+ public Float getSamplingRatio() {
+ return samplingRatio;
+ }
+
+ public void setSamplingRatio(Float samplingRatio) {
+ Object oldValue = getSamplingRatio();
+ this.samplingRatio = samplingRatio;
+ firePropertyChange(PROPERTY_SAMPLING_RATIO, oldValue, samplingRatio);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public List<Attachment> getAttachments() {
+ return attachments;
+ }
+
+ public void setAttachments(List<Attachment> attachments) {
+ Object oldValue = getAttachments();
+ this.attachments = attachments;
+ firePropertyChange(PROPERTY_ATTACHMENTS, oldValue, attachments);
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,143 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosBatchTableModel extends AbstractTuttiTableModel<BenthosBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.benthos.batch.header.speciesByCode"),
+ n_("tutti.table.benthos.batch.header.speciesByCode"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.benthos.batch.header.speciesByGenusCode"),
+ n_("tutti.table.benthos.batch.header.speciesByGenusCode"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> WEIGHT = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.benthos.batch.header.weight"),
+ n_("tutti.table.benthos.batch.header.weight"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ n_("tutti.table.benthos.batch.header.sampleWeight"),
+ n_("tutti.table.benthos.batch.header.sampleWeight"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> SAMPLING_RATIO = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SAMPLING_RATIO,
+ n_("tutti.table.benthos.batch.header.samplingRatio"),
+ n_("tutti.table.benthos.batch.header.samplingRatio"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> COMMENT = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_COMMENT,
+ n_("tutti.table.benthos.batch.header.comment"),
+ n_("tutti.table.benthos.batch.header.comment"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> ATTACHMENTS = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_ATTACHMENTS,
+ n_("tutti.table.benthos.batch.header.file"),
+ n_("tutti.table.benthos.batch.header.file"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ n_("tutti.table.benthos.batch.header.toConfirm"),
+ n_("tutti.table.benthos.batch.header.toConfirm"));
+
+ public BenthosBatchTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols(SAMPLE_WEIGHT, SAMPLING_RATIO);
+ }
+
+ @Override
+ protected BenthosBatchRowModel createNewRow() {
+ BenthosBatchRowModel result = new BenthosBatchRowModel();
+
+ // by default empty row is not valid
+ result.setValid(false);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<BenthosBatchRowModel> propertyName,
+ BenthosBatchRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+
+ if (propertyName == SPECIES_BY_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_GENUS_CODE);
+
+ } else if (propertyName == SPECIES_BY_GENUS_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_CODE);
+ }
+ }
+
+ public void updateSamplingRatio(Set<BenthosBatchRowModel> rows) {
+ for (BenthosBatchRowModel row : rows) {
+ int rowIndex = getRows().indexOf(row);
+ fireTableCellUpdated(rowIndex,
+ SAMPLE_WEIGHT,
+ SAMPLING_RATIO);
+ }
+
+
+ }
+
+ @Override
+ protected boolean isCellEditable(int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<BenthosBatchRowModel> propertyName) {
+
+ boolean result = super.isCellEditable(rowIndex,
+ columnIndex,
+ propertyName);
+
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css (from rev 104, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,83 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#benthosTotalWeightLabel {
+ text: "tutti.label.catches.benthosTotalWeight";
+ labelFor: {benthosTotalWeightField};
+}
+
+#benthosTotalWeightField {
+ property: "benthosTotalWeight";
+ model: {model.getBenthosTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#benthosTotalSortedWeightLabel {
+ text: "tutti.label.catches.benthosTotalSortedWeight";
+ labelFor: {benthosTotalSortedWeightField};
+}
+
+#benthosTotalSortedWeightField {
+ property: "benthosTotalSortedWeight";
+ model: {model.getBenthosTotalSortedWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#benthosTotalSampleSortedWeightLabel {
+ text: "tutti.label.catches.benthosTotalSampleSortedWeight";
+ labelFor: {benthosTotalSampleSortedWeightField};
+}
+
+#benthosTotalSampleSortedWeightField {
+ property: "benthosTotalSampleSortedWeight";
+ model: {model.getBenthosTotalSampleSortedWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#benthosTotalUnsortedWeightLabel {
+ text: "tutti.label.catches.benthosTotalUnsortedWeight";
+ labelFor: {benthosTotalUnsortedWeightField};
+}
+
+#benthosTotalUnsortedWeightField {
+ text: {getStringValue(model.getBenthosTotalUnsortedWeight())};
+ editable: false;
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx (from rev 104, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,126 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a 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<BenthosBatchUIModel, BenthosBatchUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.ui.swing.TuttiUI
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
+ fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ org.jdesktop.swingx.JXTable
+
+ javax.swing.ListSelectionModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+ </import>
+
+ <script><![CDATA[
+
+public BenthosBatchUI(TuttiUI<?,?> parentUI) {
+ JAXXUtil.initContext(this, parentUI);
+ BenthosBatchUIHandler handler = new BenthosBatchUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <BenthosBatchUIHandler id='handler'
+ initializer='getContextValue(BenthosBatchUIHandler.class)'/>
+
+ <BenthosBatchUIModel id='model'
+ initializer='getContextValue(BenthosBatchUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='benthosTotalWeight' component='benthosTotalWeightField'/>
+ <field name='benthosTotalSortedWeight'
+ component='benthosTotalSortedWeightField'/>
+ <field name='benthosTotalSampleSortedWeight'
+ component='benthosTotalSampleSortedWeightField'/>
+ <field name='benthosTotalUnsortedWeight'
+ component='benthosTotalUnsortedWeightField'/>
+ </BeanValidator>
+
+ <LongTextEditorUI id='longTextEditor'/>
+
+ <AttachmentEditorUI id='attachmentEditor'/>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total / Poids total vrac -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='benthosTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='benthosTotalWeightField' constructorParams='this'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='benthosTotalSortedWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='benthosTotalSortedWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids échantillonné vrac / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='benthosTotalSampleSortedWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='benthosTotalSampleSortedWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='benthosTotalUnsortedWeightLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='benthosTotalUnsortedWeightField'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table'
+ onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
+ </JScrollPane>
+
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,400 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
+import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<BenthosBatchRowModel, BenthosBatchUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(BenthosBatchUIHandler.class);
+
+ /**
+ * UI.
+ *
+ * @since 0.2
+ */
+ private final BenthosBatchUI ui;
+
+ public BenthosBatchUIHandler(TuttiUI<?, ?> parentUi,
+ BenthosBatchUI ui) {
+ super(parentUi,
+ BenthosBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ BenthosBatchRowModel.PROPERTY_SPECIES,
+ BenthosBatchRowModel.PROPERTY_WEIGHT,
+ BenthosBatchRowModel.PROPERTY_COMMENT);
+ this.ui = ui;
+
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ protected BenthosBatchUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ protected BenthosBatchTableModel getTableModel() {
+ return (BenthosBatchTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected FishingOperation getFishingOperation() {
+ return getModel().getFishingOperation();
+ }
+
+ @Override
+ protected String[] getRowPropertiesToIgnore() {
+ return new String[]{
+ BenthosBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ BenthosBatchRowModel.PROPERTY_SAMPLING_RATIO
+ };
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+
+ {
+ // Species (by code) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
+
+ addComboDataColumnToModel(columnModel,
+ BenthosBatchTableModel.SPECIES_BY_CODE,
+ decorator, allSpecies);
+ }
+
+ {
+ // Species (by genusCode) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addComboDataColumnToModel(columnModel,
+ BenthosBatchTableModel.SPECIES_BY_GENUS_CODE,
+ decorator, allSpecies);
+
+ }
+
+ { // Weight column
+
+ addFloatColumnToModel(columnModel,
+ BenthosBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Sample weight column
+
+ addColumnToModel(columnModel,
+ BenthosBatchTableModel.SAMPLE_WEIGHT);
+ }
+
+ { // SamplingRatio column
+
+ addColumnToModel(columnModel,
+ BenthosBatchTableModel.SAMPLING_RATIO);
+ }
+
+ { // Comment column
+
+ addColumnToModel(columnModel,
+ LongTextCellComponent.newEditor(ui.getLongTextEditor()),
+ LongTextCellComponent.newRender(n_("tutti.tooltip.comment.none")),
+ BenthosBatchTableModel.COMMENT);
+ }
+
+ { // File column
+
+ addColumnToModel(columnModel,
+ AttachmentCellComponent.newEditor(ui.getAttachmentEditor()),
+ AttachmentCellComponent.newRender(
+ getDecorator(Attachment.class, null),
+ n_("tutti.tooltip.attachment.none")),
+ BenthosBatchTableModel.ATTACHMENTS);
+ }
+
+ { // Species to confirm column
+
+ addBooleanColumnToModel(columnModel,
+ BenthosBatchTableModel.SPECIES_TO_CONFIRM,
+ getTable());
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(BenthosBatchRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+
+ boolean wasValid = row.isValid();
+
+ boolean valid = isRowValid(row);
+
+ if (log.isInfoEnabled()) {
+ log.info("Was valid / Is valid: " + wasValid + " / " + valid);
+ }
+ row.setValid(valid);
+ }
+
+ @Override
+ protected void onRowValidStateChanged(BenthosBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ int rowIndex = getTableModel().getRowIndex(row);
+
+ if (rowIndex > -1) {
+ getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
+ }
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(BenthosBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
+ @Override
+ protected void onModelRowsChanged(List<BenthosBatchRowModel> rows) {
+ super.onModelRowsChanged(rows);
+
+ // set valid flag
+ for (BenthosBatchRowModel row : rows) {
+ boolean valid = isRowValid(row);
+ row.setValid(valid);
+ }
+ }
+
+ @Override
+ protected void saveSelectedRowIfRequired() {
+
+ TuttiBeanMonitor<BenthosBatchRowModel> rowMonitor = getRowMonitor();
+
+ BenthosBatchRowModel bean = rowMonitor.getBean();
+ if (bean != null) {
+
+ if (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();
+ }
+ } else {
+
+ // row is not valid can not save it
+
+ BenthosBatch catchBean = bean.toBean();
+
+ if (!TuttiEntities.isNew(catchBean)) {
+
+ // remove this
+ persistenceService.deleteBenthosBatch(catchBean.getId());
+ }
+ }
+ }
+ }
+
+ @Override
+ protected boolean isRowValid(BenthosBatchRowModel row) {
+ boolean result = row.getSpecies() != null && row.getWeight() != null;
+ return result;
+ }
+
+ @Override
+ protected void saveRow(BenthosBatchRowModel row) {
+
+ BenthosBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
+ }
+
+ if (TuttiEntities.isNew(catchBean)) {
+
+ catchBean = persistenceService.createBenthosBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.saveBenthosBatch(catchBean);
+ }
+ }
+
+ @Override
+ public void selectFishingOperation(FishingOperation bean) {
+
+ JXTable table = getTable();
+
+ if (table.isEditing()) {
+
+ // make sure to stop editor
+ table.editingCanceled(null);
+ }
+
+ // make sure selection is empty (will remove bean from monitor)
+ table.clearSelection();
+
+ boolean empty = bean == null;
+
+ BenthosBatchUIModel model = getModel();
+
+ List<BenthosBatchRowModel> rows;
+
+ if (empty) {
+ rows = null;
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species batch for fishingOperation: " +
+ bean.getId());
+ }
+ rows = Lists.newArrayList();
+
+ if (!TuttiEntities.isNew(bean)) {
+ List<BenthosBatch> catches =
+ persistenceService.getAllBenthosBatch(bean.getId());
+ for (BenthosBatch aBatch : catches) {
+ BenthosBatchRowModel entry =
+ new BenthosBatchRowModel(aBatch);
+ rows.add(entry);
+ }
+ }
+ }
+
+ model.setRows(rows);
+ }
+
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public void beforeInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("beforeInit: " + ui);
+ }
+
+ EditCatchesUIModel catchesUIModel =
+ ui.getContextValue(EditCatchesUIModel.class);
+
+ BenthosBatchUIModel model = new BenthosBatchUIModel(catchesUIModel);
+ ui.setContextValue(model);
+
+// fishingOperationMonitor.setBean(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("afterInit: " + ui);
+ }
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ BenthosBatchTableModel tableModel =
+ new BenthosBatchTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ initBatchTable(table, columnModel, tableModel);
+ }
+
+ @Override
+ public void onCloseUI() {
+ if (log.isInfoEnabled()) {
+ log.info("closing: " + ui);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java (from rev 104, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,77 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosBatchUIModel extends AbstractTuttiBatchUIModel<BenthosBatchRowModel, BenthosBatchUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public BenthosBatchUIModel(EditCatchesUIModel catchesUIModel) {
+ super(catchesUIModel,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_UNSORTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_WEIGHT);
+ }
+
+ public Float getBenthosTotalWeight() {
+ return catchesUIModel.getBenthosTotalWeight();
+ }
+
+ public void setBenthosTotalWeight(Float benthosTotalWeight) {
+ catchesUIModel.setBenthosTotalWeight(benthosTotalWeight);
+ }
+
+ public Float getBenthosTotalSampleSortedWeight() {
+ return catchesUIModel.getBenthosTotalSampleSortedWeight();
+ }
+
+ public void setBenthosTotalSampleSortedWeight(Float benthosTotalSampleSortedWeight) {
+ catchesUIModel.setBenthosTotalSampleSortedWeight(benthosTotalSampleSortedWeight);
+ }
+
+ public Float getBenthosTotalSortedWeight() {
+ return catchesUIModel.getBenthosTotalSortedWeight();
+ }
+
+ public void setBenthosTotalSortedWeight(Float benthosTotalSortedWeight) {
+ catchesUIModel.setBenthosTotalSortedWeight(benthosTotalSortedWeight);
+ }
+
+ public Float getBenthosTotalUnsortedWeight() {
+ return catchesUIModel.getBenthosTotalUnsortedWeight();
+ }
+
+ public void setBenthosTotalUnsortedWeight(Float benthosTotalUnsortedWeight) {
+ catchesUIModel.setBenthosTotalUnsortedWeight(benthosTotalUnsortedWeight);
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchRowModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchRowModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,138 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.macrowaste;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * Define a benthos batch row.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroWasteBatchRowModel extends AbstractTuttiBeanUIModel<MacroWasteBatch, MacroWasteBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_MACRO_WASTE_CATEGORY = "macroWasteCategory";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_ATTACHMENTS = "attachments";
+
+ /**
+ * macroWaste category.
+ *
+ * @since 0.2
+ */
+ protected CaracteristicQualitativeValue macroWasteCategory;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Comment on this batch.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ /**
+ * Attachments.
+ *
+ * @since 0.2
+ */
+ protected List<Attachment> attachments;
+
+ protected static final Binder<MacroWasteBatch, MacroWasteBatchRowModel> fromBeanBinder =
+ BinderFactory.newBinder(MacroWasteBatch.class,
+ MacroWasteBatchRowModel.class);
+
+ protected static final Binder<MacroWasteBatchRowModel, MacroWasteBatch> toBeanBinder =
+ BinderFactory.newBinder(MacroWasteBatchRowModel.class,
+ MacroWasteBatch.class);
+
+ public MacroWasteBatchRowModel() {
+ super(MacroWasteBatch.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public MacroWasteBatchRowModel(MacroWasteBatch aBatch) {
+ this();
+ fromBean(aBatch);
+ }
+
+ public CaracteristicQualitativeValue getMacroWasteCategory() {
+ return macroWasteCategory;
+ }
+
+ public void setMacroWasteCategory(CaracteristicQualitativeValue macroWasteCategory) {
+ Object oldValue = getMacroWasteCategory();
+ this.macroWasteCategory = macroWasteCategory;
+ firePropertyChange(PROPERTY_MACRO_WASTE_CATEGORY, oldValue, macroWasteCategory);
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public List<Attachment> getAttachments() {
+ return attachments;
+ }
+
+ public void setAttachments(List<Attachment> attachments) {
+ Object oldValue = getAttachments();
+ this.attachments = attachments;
+ firePropertyChange(PROPERTY_ATTACHMENTS, oldValue, attachments);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchTableModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchTableModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,77 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.macrowaste;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroWasteBatchTableModel extends AbstractTuttiTableModel<MacroWasteBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<MacroWasteBatchRowModel> MACRO_WASTE_CATEGORY = ColumnIdentifier.newId(
+ MacroWasteBatchRowModel.PROPERTY_MACRO_WASTE_CATEGORY,
+ n_("tutti.table.macrowaste.batch.header.macroWasteCategory"),
+ n_("tutti.table.macrowaste.batch.header.macroWasteCategory"));
+
+ public static final ColumnIdentifier<MacroWasteBatchRowModel> WEIGHT = ColumnIdentifier.newId(
+ MacroWasteBatchRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.macrowaste.batch.header.weight"),
+ n_("tutti.table.macrowaste.batch.header.weight"));
+
+ public static final ColumnIdentifier<MacroWasteBatchRowModel> COMMENT = ColumnIdentifier.newId(
+ MacroWasteBatchRowModel.PROPERTY_COMMENT,
+ n_("tutti.table.macrowaste.batch.header.comment"),
+ n_("tutti.table.macrowaste.batch.header.comment"));
+
+ public static final ColumnIdentifier<MacroWasteBatchRowModel> ATTACHMENTS = ColumnIdentifier.newId(
+ MacroWasteBatchRowModel.PROPERTY_ATTACHMENTS,
+ n_("tutti.table.macrowaste.batch.header.file"),
+ n_("tutti.table.macrowaste.batch.header.file"));
+
+ public MacroWasteBatchTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols();
+ }
+
+ @Override
+ protected MacroWasteBatchRowModel createNewRow() {
+ MacroWasteBatchRowModel result = new MacroWasteBatchRowModel();
+
+ // by default empty row is not valid
+ result.setValid(false);
+ return result;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUI.css (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUI.css 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,49 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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;
+}
+
+#macroWasteTotalWeightLabel {
+ text: "tutti.label.catches.macroWasteTotalWeight";
+ labelFor: {macroWasteTotalWeightField};
+}
+
+#macroWasteTotalWeightField {
+ property: "macroWasteTotalWeight";
+ model: {model.getMacroWasteTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUI.jaxx (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUI.jaxx 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,95 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a 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<MacroWasteBatchUIModel, MacroWasteBatchUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.ui.swing.TuttiUI
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
+ fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ org.jdesktop.swingx.JXTable
+
+ javax.swing.ListSelectionModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public MacroWasteBatchUI(TuttiUI<?,?> parentUI) {
+ JAXXUtil.initContext(this, parentUI);
+ MacroWasteBatchUIHandler handler = new MacroWasteBatchUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <MacroWasteBatchUIHandler id='handler'
+ initializer='getContextValue(MacroWasteBatchUIHandler.class)'/>
+
+ <MacroWasteBatchUIModel id='model'
+ initializer='getContextValue(MacroWasteBatchUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='macroWasteTotalWeight' component='macroWasteTotalWeightField'/>
+ </BeanValidator>
+
+ <LongTextEditorUI id='longTextEditor'/>
+
+ <AttachmentEditorUI id='attachmentEditor'/>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='macroWasteTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='macroWasteTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table'
+ onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIHandler.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIHandler.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,353 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.macrowaste;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
+import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroWasteBatchUIHandler extends AbstractTuttiBatchTableUIHandler<MacroWasteBatchRowModel, MacroWasteBatchUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MacroWasteBatchUIHandler.class);
+
+ /**
+ * UI.
+ *
+ * @since 0.2
+ */
+ private final MacroWasteBatchUI ui;
+
+ public MacroWasteBatchUIHandler(TuttiUI<?, ?> parentUi, MacroWasteBatchUI ui) {
+ super(parentUi,
+ MacroWasteBatchRowModel.PROPERTY_MACRO_WASTE_CATEGORY,
+ MacroWasteBatchRowModel.PROPERTY_WEIGHT,
+ MacroWasteBatchRowModel.PROPERTY_COMMENT);
+ this.ui = ui;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ protected MacroWasteBatchUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ protected MacroWasteBatchTableModel getTableModel() {
+ return (MacroWasteBatchTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected FishingOperation getFishingOperation() {
+ return getModel().getFishingOperation();
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ {
+ // MacroWaste Category column
+
+ Decorator<CaracteristicQualitativeValue> decorator = getDecorator(
+ CaracteristicQualitativeValue.class, null);
+
+ addComboDataColumnToModel(columnModel,
+ MacroWasteBatchTableModel.MACRO_WASTE_CATEGORY,
+ decorator, persistenceService.getMacroWasteCategoryCaracteristic().getQualitativeValue());
+ }
+
+ { // Weight column
+
+ addFloatColumnToModel(columnModel,
+ MacroWasteBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Comment column
+
+ addColumnToModel(columnModel,
+ LongTextCellComponent.newEditor(ui.getLongTextEditor()),
+ LongTextCellComponent.newRender(n_("tutti.tooltip.comment.none")),
+ MacroWasteBatchTableModel.COMMENT);
+ }
+
+ { // File column
+
+ addColumnToModel(columnModel,
+ AttachmentCellComponent.newEditor(ui.getAttachmentEditor()),
+ AttachmentCellComponent.newRender(
+ getDecorator(Attachment.class, null),
+ n_("tutti.tooltip.attachment.none")),
+ MacroWasteBatchTableModel.ATTACHMENTS);
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(MacroWasteBatchRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+
+ boolean wasValid = row.isValid();
+
+ boolean valid = isRowValid(row);
+
+ if (log.isInfoEnabled()) {
+ log.info("Was valid / Is valid: " + wasValid + " / " + valid);
+ }
+ row.setValid(valid);
+ }
+
+ @Override
+ protected void onRowValidStateChanged(MacroWasteBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ int rowIndex = getTableModel().getRowIndex(row);
+
+ if (rowIndex > -1) {
+ getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
+ }
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(MacroWasteBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
+ @Override
+ protected void onModelRowsChanged(List<MacroWasteBatchRowModel> rows) {
+ super.onModelRowsChanged(rows);
+
+ // set valid flag
+ for (MacroWasteBatchRowModel row : rows) {
+ boolean valid = isRowValid(row);
+ row.setValid(valid);
+ }
+ }
+
+ @Override
+ protected void saveSelectedRowIfRequired() {
+
+ TuttiBeanMonitor<MacroWasteBatchRowModel> rowMonitor = getRowMonitor();
+
+ MacroWasteBatchRowModel bean = rowMonitor.getBean();
+ if (bean != null) {
+
+ if (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();
+ }
+ } else {
+
+ // row is not valid can not save it
+
+ MacroWasteBatch catchBean = bean.toBean();
+
+ if (!TuttiEntities.isNew(catchBean)) {
+
+ // remove this
+ persistenceService.deleteMacroWasteBatch(catchBean.getId());
+ }
+ }
+ }
+ }
+
+ @Override
+ protected boolean isRowValid(MacroWasteBatchRowModel row) {
+ boolean result = row.getMacroWasteCategory() != null &&
+ row.getWeight() != null;
+ return result;
+ }
+
+ @Override
+ protected void saveRow(MacroWasteBatchRowModel row) {
+
+ MacroWasteBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
+ }
+
+ if (TuttiEntities.isNew(catchBean)) {
+
+ catchBean = persistenceService.createMacroWasteBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.saveMacroWasteBatch(catchBean);
+ }
+ }
+
+ @Override
+ public void selectFishingOperation(FishingOperation bean) {
+
+ JXTable table = getTable();
+
+ if (table.isEditing()) {
+
+ // make sure to stop editor
+ table.editingCanceled(null);
+ }
+
+ // make sure selection is empty (will remove bean from monitor)
+ table.clearSelection();
+
+ boolean empty = bean == null;
+
+ MacroWasteBatchUIModel model = getModel();
+
+ List<MacroWasteBatchRowModel> rows;
+
+ if (empty) {
+ rows = null;
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species batch for fishingOperation: " +
+ bean.getId());
+ }
+ rows = Lists.newArrayList();
+
+ if (!TuttiEntities.isNew(bean)) {
+ List<MacroWasteBatch> catches =
+ persistenceService.getAllMacroWasteBatch(bean.getId());
+ for (MacroWasteBatch aBatch : catches) {
+ MacroWasteBatchRowModel entry =
+ new MacroWasteBatchRowModel(aBatch);
+ rows.add(entry);
+ }
+ }
+ }
+
+ model.setRows(rows);
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public void beforeInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("beforeInit: " + ui);
+ }
+
+ EditCatchesUIModel catchesUIModel =
+ ui.getContextValue(EditCatchesUIModel.class);
+
+ MacroWasteBatchUIModel model = new MacroWasteBatchUIModel(catchesUIModel);
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("afterInit: " + ui);
+ }
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ MacroWasteBatchTableModel tableModel =
+ new MacroWasteBatchTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ initBatchTable(table, columnModel, tableModel);
+ }
+
+ @Override
+ public void onCloseUI() {
+ if (log.isInfoEnabled()) {
+ log.info("closing: " + ui);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,50 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.macrowaste;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroWasteBatchUIModel extends AbstractTuttiBatchUIModel<MacroWasteBatchRowModel, MacroWasteBatchUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public MacroWasteBatchUIModel(EditCatchesUIModel catchesUIModel) {
+ super(catchesUIModel,
+ EditCatchesUIModel.PROPERTY_MACRO_WASTE_TOTAL_WEIGHT);
+ }
+
+ public Float getMacroWasteTotalWeight() {
+ return catchesUIModel.getMacroWasteTotalWeight();
+ }
+
+ public void setMacroWasteTotalWeight(Float macroWasteTotalWeight) {
+ catchesUIModel.setMacroWasteTotalWeight(macroWasteTotalWeight);
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchRowModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchRowModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,195 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.plankton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.PlanktonBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * Define a benthos batch row.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanktonBatchRowModel extends AbstractTuttiBeanUIModel<PlanktonBatch, PlanktonBatchRowModel> {
+
+ 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_WEIGHT = "weight";
+
+ public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
+
+ public static final String PROPERTY_SAMPLING_RATIO = "samplingRatio";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_ATTACHMENTS = "attachments";
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected Species species;
+
+ /**
+ * Is the species need to be confirmed?.
+ *
+ * @since 0.2
+ */
+ protected boolean speciesToConfirm;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Sample weight.
+ *
+ * @since 0.2
+ */
+ protected Float sampleWeight;
+
+ /**
+ * Sampling ratio.
+ *
+ * @since 0.2
+ */
+ protected Float samplingRatio;
+
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ /**
+ * Attachments
+ *
+ * @since 0.2
+ */
+ protected List<Attachment> attachments;
+
+ protected static final Binder<PlanktonBatch, PlanktonBatchRowModel> fromBeanBinder =
+ BinderFactory.newBinder(PlanktonBatch.class,
+ PlanktonBatchRowModel.class);
+
+ protected static final Binder<PlanktonBatchRowModel, PlanktonBatch> toBeanBinder =
+ BinderFactory.newBinder(PlanktonBatchRowModel.class,
+ PlanktonBatch.class);
+
+ public PlanktonBatchRowModel() {
+ super(PlanktonBatch.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public PlanktonBatchRowModel(PlanktonBatch aBatch) {
+ this();
+ fromBean(aBatch);
+ }
+
+ 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 Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public Float getSampleWeight() {
+ return sampleWeight;
+ }
+
+ public void setSampleWeight(Float sampleWeight) {
+ Object oldValue = getSampleWeight();
+ this.sampleWeight = sampleWeight;
+ firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
+ }
+
+ public Float getSamplingRatio() {
+ return samplingRatio;
+ }
+
+ public void setSamplingRatio(Float samplingRatio) {
+ Object oldValue = getSamplingRatio();
+ this.samplingRatio = samplingRatio;
+ firePropertyChange(PROPERTY_SAMPLING_RATIO, oldValue, samplingRatio);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public List<Attachment> getAttachments() {
+ return attachments;
+ }
+
+ public void setAttachments(List<Attachment> attachments) {
+ Object oldValue = getAttachments();
+ this.attachments = attachments;
+ firePropertyChange(PROPERTY_ATTACHMENTS, oldValue, attachments);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchTableModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchTableModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,117 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.plankton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanktonBatchTableModel extends AbstractTuttiTableModel<PlanktonBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ n_("tutti.table.plankton.batch.header.toConfirm"),
+ n_("tutti.table.plankton.batch.header.toConfirm"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.plankton.batch.header.speciesByCode"),
+ n_("tutti.table.plankton.batch.header.speciesByCode"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.plankton.batch.header.speciesByGenusCode"),
+ n_("tutti.table.plankton.batch.header.speciesByGenusCode"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> WEIGHT = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.plankton.batch.header.weight"),
+ n_("tutti.table.plankton.batch.header.weight"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ n_("tutti.table.plankton.batch.header.sampleWeight"),
+ n_("tutti.table.plankton.batch.header.sampleWeight"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> SAMPLING_RATIO = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_SAMPLING_RATIO,
+ n_("tutti.table.plankton.batch.header.elevationRate"),
+ n_("tutti.table.plankton.batch.header.elevationRate"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> COMMENT = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_COMMENT,
+ n_("tutti.table.plankton.batch.header.comment"),
+ n_("tutti.table.plankton.batch.header.comment"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> ATTACHMENTS = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_ATTACHMENTS,
+ n_("tutti.table.plankton.batch.header.file"),
+ n_("tutti.table.plankton.batch.header.file"));
+
+ public PlanktonBatchTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols(SAMPLE_WEIGHT, SAMPLING_RATIO);
+ }
+
+ @Override
+ protected PlanktonBatchRowModel createNewRow() {
+ PlanktonBatchRowModel result = new PlanktonBatchRowModel();
+
+ // by default empty row is not valid
+ result.setValid(false);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<PlanktonBatchRowModel> propertyName,
+ PlanktonBatchRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+
+ if (propertyName == SPECIES_BY_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex, SPECIES_BY_GENUS_CODE);
+
+ } else if (propertyName == SPECIES_BY_GENUS_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex, SPECIES_BY_CODE);
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUI.css (from rev 104, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUI.css 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,61 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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;
+}
+
+#planktonTotalWeightLabel {
+ text: "tutti.label.catches.planktonTotalWeight";
+ labelFor: {planktonTotalWeightField};
+}
+
+#planktonTotalWeightField {
+ property: "planktonTotalWeight";
+ model: {model.getPlanktonTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#planktonTotalSampleWeightLabel {
+ text: "tutti.label.catches.planktonTotalSampleWeight";
+ labelFor: {planktonTotalSampleWeightField};
+}
+
+#planktonTotalSampleWeightField {
+ property: "planktonTotalSampleWeight";
+ model: {model.getPlanktonTotalSampleWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUI.jaxx (from rev 104, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUI.jaxx 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,107 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a 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<PlanktonBatchUIModel, PlanktonBatchUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.ui.swing.TuttiUI
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
+ fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ org.jdesktop.swingx.JXTable
+
+ javax.swing.ListSelectionModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public PlanktonBatchUI(TuttiUI<?,?> parentUI) {
+ JAXXUtil.initContext(this, parentUI);
+ PlanktonBatchUIHandler handler = new PlanktonBatchUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <PlanktonBatchUIHandler id='handler'
+ initializer='getContextValue(PlanktonBatchUIHandler.class)'/>
+
+ <PlanktonBatchUIModel id='model'
+ initializer='getContextValue(PlanktonBatchUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='planktonTotalWeight' component='planktonTotalWeightField'/>
+ <field name='planktonTotalSampleWeight'
+ component='planktonTotalSampleWeightField'/>
+ </BeanValidator>
+
+ <LongTextEditorUI id='longTextEditor'/>
+
+ <AttachmentEditorUI id='attachmentEditor'/>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='planktonTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='planktonTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='planktonTotalSampleWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='planktonTotalSampleWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table'
+ onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIHandler.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIHandler.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,397 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.plankton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.PlanktonBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
+import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanktonBatchUIHandler extends AbstractTuttiBatchTableUIHandler<PlanktonBatchRowModel, PlanktonBatchUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(PlanktonBatchUIHandler.class);
+
+ /**
+ * UI.
+ *
+ * @since 0.2
+ */
+ private final PlanktonBatchUI ui;
+
+ public PlanktonBatchUIHandler(TuttiUI<?, ?> parentUi, PlanktonBatchUI ui) {
+ super(parentUi,
+ PlanktonBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ PlanktonBatchRowModel.PROPERTY_SPECIES,
+ PlanktonBatchRowModel.PROPERTY_WEIGHT,
+ PlanktonBatchRowModel.PROPERTY_COMMENT);
+ this.ui = ui;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ protected PlanktonBatchUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ protected PlanktonBatchTableModel getTableModel() {
+ return (PlanktonBatchTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected FishingOperation getFishingOperation() {
+ return getModel().getFishingOperation();
+ }
+
+ @Override
+ protected String[] getRowPropertiesToIgnore() {
+ return new String[]{
+ PlanktonBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ PlanktonBatchRowModel.PROPERTY_SAMPLING_RATIO
+ };
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ {
+ // Species to confirm column
+
+ addBooleanColumnToModel(columnModel,
+ PlanktonBatchTableModel.SPECIES_TO_CONFIRM,
+ getTable());
+ }
+
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+
+ {
+ // Species (by code) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
+
+ addComboDataColumnToModel(columnModel,
+ PlanktonBatchTableModel.SPECIES_BY_CODE,
+ decorator, allSpecies);
+ }
+
+ {
+ // Species (by genusCode) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addComboDataColumnToModel(columnModel,
+ PlanktonBatchTableModel.SPECIES_BY_GENUS_CODE,
+ decorator, allSpecies);
+
+ }
+
+ { // Weight column
+
+ addFloatColumnToModel(columnModel,
+ PlanktonBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Sample weight column
+
+ addColumnToModel(columnModel,
+ PlanktonBatchTableModel.SAMPLE_WEIGHT);
+ }
+
+ { // SamplingRatio column
+
+ addColumnToModel(columnModel,
+ PlanktonBatchTableModel.SAMPLING_RATIO);
+ }
+
+ { // Comment column
+
+ addColumnToModel(columnModel,
+ LongTextCellComponent.newEditor(ui.getLongTextEditor()),
+ LongTextCellComponent.newRender(n_("tutti.tooltip.comment.none")),
+ PlanktonBatchTableModel.COMMENT);
+ }
+
+ { // File column
+
+ addColumnToModel(columnModel,
+ AttachmentCellComponent.newEditor(ui.getAttachmentEditor()),
+ AttachmentCellComponent.newRender(
+ getDecorator(Attachment.class, null),
+ n_("tutti.tooltip.attachment.none")),
+ PlanktonBatchTableModel.ATTACHMENTS);
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(PlanktonBatchRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+
+ boolean wasValid = row.isValid();
+
+ boolean valid = isRowValid(row);
+
+ if (log.isInfoEnabled()) {
+ log.info("Was valid / Is valid: " + wasValid + " / " + valid);
+ }
+ row.setValid(valid);
+ }
+
+ @Override
+ protected void onRowValidStateChanged(PlanktonBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ int rowIndex = getTableModel().getRowIndex(row);
+
+ if (rowIndex > -1) {
+ getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
+ }
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(PlanktonBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
+ @Override
+ protected void onModelRowsChanged(List<PlanktonBatchRowModel> rows) {
+ super.onModelRowsChanged(rows);
+
+ // set valid flag
+ for (PlanktonBatchRowModel row : rows) {
+ boolean valid = isRowValid(row);
+ row.setValid(valid);
+ }
+ }
+
+ @Override
+ protected void saveSelectedRowIfRequired() {
+
+ TuttiBeanMonitor<PlanktonBatchRowModel> rowMonitor = getRowMonitor();
+
+ PlanktonBatchRowModel bean = rowMonitor.getBean();
+ if (bean != null) {
+
+ if (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();
+ }
+ } else {
+
+ // row is not valid can not save it
+
+ PlanktonBatch catchBean = bean.toBean();
+
+ if (!TuttiEntities.isNew(catchBean)) {
+
+ // remove this
+ persistenceService.deletePlanktonBatch(catchBean.getId());
+ }
+ }
+ }
+ }
+
+ @Override
+ protected boolean isRowValid(PlanktonBatchRowModel row) {
+ boolean result = row.getSpecies() != null && row.getWeight() != null;
+ return result;
+ }
+
+ @Override
+ protected void saveRow(PlanktonBatchRowModel row) {
+
+ PlanktonBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
+ }
+
+ if (TuttiEntities.isNew(catchBean)) {
+
+ catchBean = persistenceService.createPlanktonBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.savePlanktonBatch(catchBean);
+ }
+ }
+
+ @Override
+ public void selectFishingOperation(FishingOperation bean) {
+
+ JXTable table = getTable();
+
+ if (table.isEditing()) {
+
+ // make sure to stop editor
+ table.editingCanceled(null);
+ }
+
+ // make sure selection is empty (will remove bean from monitor)
+ table.clearSelection();
+
+ boolean empty = bean == null;
+
+ PlanktonBatchUIModel model = getModel();
+
+ List<PlanktonBatchRowModel> rows;
+
+ if (empty) {
+ rows = null;
+ } else {
+
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species batch for fishingOperation: " +
+ bean.getId());
+ }
+ rows = Lists.newArrayList();
+
+ if (!TuttiEntities.isNew(bean)) {
+ List<PlanktonBatch> catches =
+ persistenceService.getAllPlanktonBatch(bean.getId());
+ for (PlanktonBatch aBatch : catches) {
+ PlanktonBatchRowModel entry =
+ new PlanktonBatchRowModel(aBatch);
+ rows.add(entry);
+ }
+ }
+ }
+
+ model.setRows(rows);
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public void beforeInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("beforeInit: " + ui);
+ }
+
+ EditCatchesUIModel catchesUIModel =
+ ui.getContextValue(EditCatchesUIModel.class);
+
+ PlanktonBatchUIModel model = new PlanktonBatchUIModel(catchesUIModel);
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("afterInit: " + ui);
+ }
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ PlanktonBatchTableModel tableModel =
+ new PlanktonBatchTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ initBatchTable(table, columnModel, tableModel);
+ }
+
+ @Override
+ public void onCloseUI() {
+ if (log.isInfoEnabled()) {
+ log.info("closing: " + ui);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIModel.java (from rev 104, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,59 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.plankton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanktonBatchUIModel extends AbstractTuttiBatchUIModel<PlanktonBatchRowModel, PlanktonBatchUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public PlanktonBatchUIModel(EditCatchesUIModel catchesUIModel) {
+ super(catchesUIModel,
+ EditCatchesUIModel.PROPERTY_PLANKTON_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_PLANKTON_TOTAL_SAMPLE_WEIGHT);
+ }
+
+ public Float getPlanktonTotalWeight() {
+ return catchesUIModel.getPlanktonTotalWeight();
+ }
+
+ public void setPlanktonTotalWeight(Float planktonTotalWeight) {
+ catchesUIModel.setPlanktonTotalWeight(planktonTotalWeight);
+ }
+
+ public Float getPlanktonTotalSampleWeight() {
+ return catchesUIModel.getPlanktonTotalSampleWeight();
+ }
+
+ public void setPlanktonTotalSampleWeight(Float planktonTotalSampleWeight) {
+ catchesUIModel.setPlanktonTotalSampleWeight(planktonTotalSampleWeight);
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/FrequencyCellComponent.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/FrequencyCellComponent.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/FrequencyCellComponent.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,257 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.JButton;
+import javax.swing.JTable;
+import javax.swing.border.LineBorder;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Frame;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Component to render and edit frequency stuff from batch table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class FrequencyCellComponent extends JButton {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String ROW_INDEX = "rowIndex";
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(FrequencyCellComponent.class);
+
+ public FrequencyCellComponent() {
+ setContentAreaFilled(false);
+ setOpaque(false);
+ setIcon(SwingUtil.createActionIcon("show-frequency"));
+ }
+
+ public static TableCellRenderer newRender() {
+ return new FrequencyCellRenderer();
+ }
+
+ public static TableCellEditor newEditor(SpeciesFrequencyUI ui) {
+ return new FrequencyCellEditor(ui);
+ }
+
+ public static class FrequencyCellEditor extends AbstractCellEditor implements TableCellEditor {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final FrequencyCellComponent component;
+
+ protected final SpeciesFrequencyUI ui;
+
+ protected Frame frame;
+
+ protected JTable table;
+
+ protected SpeciesBatchTableModel tableModel;
+
+ protected ColumnIdentifier<SpeciesBatchRowModel> columnIdentifier;
+
+ protected SpeciesBatchRowModel editRow;
+
+ protected Integer rowIndex;
+
+ protected Integer columnIndex;
+
+ public FrequencyCellEditor(SpeciesFrequencyUI ui) {
+ this.ui = ui;
+ component = new FrequencyCellComponent();
+ component.setBorder(new LineBorder(Color.BLACK));
+ component.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER ||
+ e.getKeyCode() == KeyEvent.VK_SPACE) {
+ e.consume();
+ startEdit();
+ }
+ }
+ });
+
+ component.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ e.consume();
+ startEdit();
+ }
+ });
+ }
+
+ protected void startEdit() {
+
+ Preconditions.checkNotNull(tableModel, "No table model assigned.");
+
+ // open frequency dialog
+
+ Preconditions.checkNotNull(editRow, "No editRow found.");
+
+ if (log.isInfoEnabled()) {
+ log.info("Will edit frequencies for row: " + rowIndex);
+ }
+
+ if (frame == null) {
+ frame = SwingUtil.getParentContainer(ui, Frame.class);
+ }
+
+ ui.editBatch(editRow);
+
+ // open frequency dialog
+ TuttiUIUtil.openInDialog(
+ ui, frame, _("tutti.title.frequency"), true, null);
+
+ // at close, synch back frequencies
+
+ editRow.updateTotalFromFrequencies();
+
+ int r = rowIndex;
+ int c = columnIndex;
+
+ // stop edition
+ stopCellEditing();
+
+ // reselect this cell
+ AbstractSelectTableAction.doSelectCell(table, r, c);
+ table.requestFocus();
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ int row,
+ int column) {
+ if (tableModel == null) {
+ tableModel = (SpeciesBatchTableModel) table.getModel();
+ this.table = table;
+ columnIdentifier = tableModel.getPropertyName(column);
+ }
+ String text;
+ if (value == null) {
+ text = " - ";
+ } else {
+ text = String.valueOf(value);
+ }
+ component.setText(text);
+
+ rowIndex = row;
+ columnIndex = column;
+
+ editRow = tableModel.getEntry(row);
+
+ return component;
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+
+ Preconditions.checkNotNull(editRow, "No editRow found in editor.");
+
+ Object result;
+ if (columnIdentifier == SpeciesBatchTableModel.COMPUTED_NUMBER) {
+ result = editRow.getComputedNumber();
+ } else {
+ result = editRow.getComputedWeight();
+ }
+ if (log.isInfoEnabled()) {
+ log.info("editor value (" + columnIdentifier + "): " + result);
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean stopCellEditing() {
+ boolean b = super.stopCellEditing();
+ if (b) {
+ rowIndex = null;
+ editRow = null;
+ columnIndex = null;
+ }
+ return b;
+ }
+
+ @Override
+ public void cancelCellEditing() {
+ super.cancelCellEditing();
+ rowIndex = null;
+ columnIndex = null;
+ editRow = null;
+ }
+ }
+
+ public static class FrequencyCellRenderer implements TableCellRenderer {
+
+ protected final FrequencyCellComponent component;
+
+ public FrequencyCellRenderer() {
+ component = new FrequencyCellComponent();
+ }
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row,
+ int column) {
+
+ String text;
+ if (value == null) {
+ text = " - ";
+ } else {
+ text = String.valueOf(value);
+ }
+ boolean editable = table.isCellEditable(row, column);
+ component.setEnabled(editable);
+ component.setText(text);
+ return component;
+ }
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/FrequencyCellComponent.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,390 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.apache.commons.collections.CollectionUtils;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Represents a species batch (i.e a row in the batch table).
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, SpeciesBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_SPECIES = "species";
+
+ public static final String PROPERTY_SPECIES_TO_CONFIRM = "speciesToConfirm";
+
+ public static final String PROPERTY_SORTED_UNSORTED_CATEGORY = "sortedUnsortedCategory";
+
+ public static final String PROPERTY_SIZE_CATEGORY = "sizeCategory";
+
+ public static final String PROPERTY_SEX_CATEGORY = "sexCategory";
+
+ public static final String PROPERTY_MATURITY_CATEGORY = "maturityCategory";
+
+ public static final String PROPERTY_AGE = "age";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
+
+ public static final String PROPERTY_SAMPLING_RATIO = "samplingRatio";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_FREQUENCY = "frequency";
+
+ public static final String PROPERTY_COMPUTED_NUMBER = "computedNumber";
+
+ public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight";
+
+ public static final String PROPERTY_ATTACHMENTS = "attachments";
+
+ /**
+ * 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 CaracteristicQualitativeValue sortedUnsortedCategory;
+
+ /**
+ * Weight category (can be null).
+ *
+ * @since 0.2
+ */
+ protected CaracteristicQualitativeValue sizeCategory;
+
+ /**
+ * Sex (can be null).
+ *
+ * @since 0.2
+ */
+ protected CaracteristicQualitativeValue sexCategory;
+
+ /**
+ * Maturity (can be null).
+ *
+ * @since 0.2
+ */
+ protected CaracteristicQualitativeValue maturityCategory;
+
+ /**
+ * 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;
+
+ /**
+ * Sampling ratio.
+ *
+ * @since 0.2
+ */
+ protected Float samplingRatio;
+
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ /**
+ * Attachments
+ *
+ * @since 0.2
+ */
+ protected List<Attachment> attachments;
+
+ /**
+ * List of frequencies observed for this batch.
+ *
+ * @since 0.2
+ */
+ protected List<SpeciesFrequencyRowModel> frequency;
+
+ protected static final Binder<SpeciesBatch, SpeciesBatchRowModel> fromBeanBinder =
+ BinderFactory.newBinder(SpeciesBatch.class,
+ SpeciesBatchRowModel.class);
+
+ protected static final Binder<SpeciesBatchRowModel, SpeciesBatch> toBeanBinder =
+ BinderFactory.newBinder(SpeciesBatchRowModel.class,
+ SpeciesBatch.class);
+
+ public SpeciesBatchRowModel() {
+ super(SpeciesBatch.class, fromBeanBinder, toBeanBinder);
+ frequency = Lists.newArrayList();
+ }
+
+ public SpeciesBatchRowModel(SpeciesBatch aBatch,
+ List<SpeciesBatchFrequency> frequencies) {
+ this();
+ fromBean(aBatch);
+ List<SpeciesFrequencyRowModel> frequencyRows =
+ SpeciesFrequencyRowModel.fromBeans(frequencies);
+ frequency.addAll(frequencyRows);
+ Collections.sort(frequency);
+ updateTotalFromFrequencies();
+ }
+
+ public void updateTotalFromFrequencies() {
+ Float totalNumber = null;
+ Float totalWeight = null;
+ if (CollectionUtils.isNotEmpty(frequency)) {
+ totalNumber = 0f;
+ totalWeight = 0f;
+ for (SpeciesFrequencyRowModel frequencyModel : frequency) {
+ totalNumber += frequencyModel.getNumber();
+ Float w = frequencyModel.getWeight();
+ if (w == null) {
+
+ // can't sum when a null value appears
+ totalWeight = null;
+ } else if (totalWeight != null) {
+
+ // still can sum weights
+ totalWeight += w;
+ }
+ }
+ }
+
+ setComputedNumber(totalNumber);
+ setComputedWeight(totalWeight);
+ }
+
+ public Species getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(Species species) {
+ Object oldValue = getSpecies();
+ this.species = species;
+ firePropertyChange(PROPERTY_SPECIES, oldValue, species);
+ }
+
+ public Boolean getSpeciesToConfirm() {
+ return speciesToConfirm;
+ }
+
+ public void setSpeciesToConfirm(Boolean speciesToConfirm) {
+ Object oldValue = getSpeciesToConfirm();
+ this.speciesToConfirm = speciesToConfirm;
+ firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
+ }
+
+ public CaracteristicQualitativeValue getSortedUnsortedCategory() {
+ return sortedUnsortedCategory;
+ }
+
+ public void setSortedUnsortedCategory(CaracteristicQualitativeValue sortedUnsortedCategory) {
+ Object oldValue = getSortedUnsortedCategory();
+ this.sortedUnsortedCategory = sortedUnsortedCategory;
+ firePropertyChange(PROPERTY_SORTED_UNSORTED_CATEGORY, oldValue, sortedUnsortedCategory);
+ }
+
+ public CaracteristicQualitativeValue getSizeCategory() {
+ return sizeCategory;
+ }
+
+ public void setSizeCategory(CaracteristicQualitativeValue sizeCategory) {
+ Object oldValue = getSizeCategory();
+ this.sizeCategory = sizeCategory;
+ firePropertyChange(PROPERTY_SIZE_CATEGORY, oldValue, sizeCategory);
+ }
+
+ public CaracteristicQualitativeValue getSexCategory() {
+ return sexCategory;
+ }
+
+ public void setSexCategory(CaracteristicQualitativeValue sexCategory) {
+ Object oldValue = getSexCategory();
+ this.sexCategory = sexCategory;
+ firePropertyChange(PROPERTY_SEX_CATEGORY, oldValue, sexCategory);
+ }
+
+ public CaracteristicQualitativeValue getMaturityCategory() {
+ return maturityCategory;
+ }
+
+ public void setMaturityCategory(CaracteristicQualitativeValue maturityCategory) {
+ Object oldValue = getMaturityCategory();
+ this.maturityCategory = maturityCategory;
+ firePropertyChange(PROPERTY_MATURITY_CATEGORY, oldValue, maturityCategory);
+ }
+
+ public Float getAge() {
+ return age;
+ }
+
+ public void setAge(Float age) {
+ Object oldValue = getAge();
+ this.age = age;
+ firePropertyChange(PROPERTY_AGE, oldValue, age);
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public Float getSampleWeight() {
+ return sampleWeight;
+ }
+
+ public void setSampleWeight(Float sampleWeight) {
+ Object oldValue = getSampleWeight();
+ this.sampleWeight = sampleWeight;
+ firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
+ }
+
+ public Float getSamplingRatio() {
+ return samplingRatio;
+ }
+
+ public void setSamplingRatio(Float samplingRatio) {
+ Object oldValue = getSamplingRatio();
+ this.samplingRatio = samplingRatio;
+ firePropertyChange(PROPERTY_SAMPLING_RATIO, oldValue, samplingRatio);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public List<Attachment> getAttachments() {
+ return attachments;
+ }
+
+ public void setAttachments(List<Attachment> attachments) {
+ Object oldValue = getAttachments();
+ this.attachments = attachments;
+ firePropertyChange(PROPERTY_ATTACHMENTS, oldValue, attachments);
+ }
+
+ 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);
+ }
+
+ public int getRowCount() {
+ return frequency == null ? 0 : frequency.size();
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/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/operation/catches/species/SpeciesBatchTableModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,202 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesBatchTableModel extends AbstractTuttiTableModel<SpeciesBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.species.batch.header.speciesByCode"),
+ n_("tutti.table.species.batch.header.speciesByCode"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.species.batch.header.speciesByGenusCode"),
+ n_("tutti.table.species.batch.header.speciesByGenusCode"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SORTED_UNSORTED_CATEGORY = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
+ n_("tutti.table.species.batch.header.sortedUnsortedCategory"),
+ n_("tutti.table.species.batch.header.sortedUnsortedCategory"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SIZE_CATEGORY = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SIZE_CATEGORY,
+ n_("tutti.table.species.batch.header.sizeCategory"),
+ n_("tutti.table.species.batch.header.sizeCategory"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SEX_CATEGORY = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SEX_CATEGORY,
+ n_("tutti.table.species.batch.header.sexCategory"),
+ n_("tutti.table.species.batch.header.sexCategory"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> MATURITY_CATEGORY = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_MATURITY_CATEGORY,
+ n_("tutti.table.species.batch.header.maturityCategory"),
+ n_("tutti.table.species.batch.header.maturityCategory"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> AGE = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_AGE,
+ n_("tutti.table.species.batch.header.age"),
+ n_("tutti.table.species.batch.header.age"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> WEIGHT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.species.batch.header.weight"),
+ n_("tutti.table.species.batch.header.weight"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_COMPUTED_WEIGHT,
+ n_("tutti.table.species.batch.header.computedWeight"),
+ n_("tutti.table.species.batch.header.computedWeight"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_NUMBER = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_COMPUTED_NUMBER,
+ n_("tutti.table.species.batch.header.computedNumber"),
+ n_("tutti.table.species.batch.header.computedNumber"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ n_("tutti.table.species.batch.header.sampleWeight"),
+ n_("tutti.table.species.batch.header.sampleWeight"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SAMPLING_RATIO = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
+ n_("tutti.table.species.batch.header.elevationRate"),
+ n_("tutti.table.species.batch.header.elevationRate"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> COMMENT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_COMMENT,
+ n_("tutti.table.species.batch.header.comment"),
+ n_("tutti.table.species.batch.header.comment"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> ATTACHMENTS = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_ATTACHMENTS,
+ n_("tutti.table.species.batch.header.file"),
+ n_("tutti.table.species.batch.header.file"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ n_("tutti.table.species.batch.header.toConfirm"),
+ n_("tutti.table.species.batch.header.toConfirm"));
+
+ protected final Set<ColumnIdentifier<SpeciesBatchRowModel>> noneEditableColIfNoSpecies;
+
+ public SpeciesBatchTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols(SAMPLE_WEIGHT, SAMPLING_RATIO);
+ noneEditableColIfNoSpecies = Sets.newHashSet();
+ noneEditableColIfNoSpecies.add(COMPUTED_NUMBER);
+ noneEditableColIfNoSpecies.add(COMPUTED_WEIGHT);
+ }
+
+ @Override
+ protected SpeciesBatchRowModel createNewRow() {
+ SpeciesBatchRowModel result = new SpeciesBatchRowModel();
+
+ // by default empty row is not valid
+ result.setValid(false);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<SpeciesBatchRowModel> propertyName,
+ SpeciesBatchRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+
+ if (propertyName == SPECIES_BY_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_GENUS_CODE,
+ COMPUTED_NUMBER,
+ COMPUTED_WEIGHT);
+
+ } else if (propertyName == SPECIES_BY_GENUS_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_CODE,
+ COMPUTED_NUMBER,
+ COMPUTED_WEIGHT);
+ } else if (propertyName == COMPUTED_NUMBER) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex, COMPUTED_WEIGHT);
+
+ } else if (propertyName == COMPUTED_WEIGHT) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex, COMPUTED_NUMBER);
+ }
+ }
+
+ public void updateSamplingRatio(Set<SpeciesBatchRowModel> rows) {
+ for (SpeciesBatchRowModel row : rows) {
+ int rowIndex = getRows().indexOf(row);
+ fireTableCellUpdated(rowIndex, SAMPLE_WEIGHT, SAMPLING_RATIO);
+ }
+
+
+ }
+
+ @Override
+ protected boolean isCellEditable(int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<SpeciesBatchRowModel> propertyName) {
+
+ boolean result = super.isCellEditable(rowIndex,
+ columnIndex,
+ propertyName);
+ if (result) {
+
+ if (noneEditableColIfNoSpecies.contains(propertyName)) {
+
+ // must have filled a species to edit this column
+ SpeciesBatchRowModel entry = getEntry(rowIndex);
+ result = entry.getSpecies() != null;
+ }
+ }
+ return result;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/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/operation/catches/species/SpeciesBatchTreeModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTreeModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTreeModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,297 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.HashMultimap;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import org.apache.commons.collections.CollectionUtils;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @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 String[] samplingOrder;
+
+ /**
+ * Mapping from row to node.
+ *
+ * @since 0.2
+ */
+ protected final Map<SpeciesBatchRowModel, SpeciesBatchTreeNode> rowToNode;
+
+ /**
+ * Mapping from node to row.
+ *
+ * @since 0.2
+ */
+ protected final Multimap<SpeciesBatchTreeNode, SpeciesBatchRowModel> nodeToRow;
+
+ public SpeciesBatchTreeModel(String... samplingOrder) {
+ this.samplingOrder = samplingOrder;
+ root = new SpeciesBatchTreeNode();
+ rowToNode = Maps.newHashMap();
+ nodeToRow = HashMultimap.create();
+ }
+
+ public void populate(List<SpeciesBatchRowModel> rows) {
+
+ clear();
+
+ for (SpeciesBatchRowModel row : rows) {
+
+ SpeciesBatchTreeNode node = getSamplingNode(row);
+
+ // check if row is valid
+ boolean rowIsValid = isValid(row, node);
+
+ // set it in row
+ row.setValid(rowIsValid);
+ }
+ }
+
+ public String[] getSamplingOrder() {
+ return samplingOrder;
+ }
+
+ public void setSamplingOrder(String... samplingOrder) {
+ this.samplingOrder = samplingOrder;
+ clear();
+ }
+
+ protected void clear() {
+ // clear tree representation
+ root.removeAllChildren();
+
+ // clear mappings
+ rowToNode.clear();
+ nodeToRow.clear();
+ }
+
+ public SpeciesBatchTreeNode removeNodeFromCache(SpeciesBatchRowModel row) {
+ SpeciesBatchTreeNode result = rowToNode.remove(row);
+ if (result != null) {
+
+ nodeToRow.remove(result, row);
+ }
+ return result;
+ }
+
+ public SpeciesBatchTreeNode getSamplingNode(SpeciesBatchRowModel row) {
+
+ // search frist in cache
+ SpeciesBatchTreeNode result = rowToNode.get(row);
+
+ if (result == null) {
+
+ // not in cache must build the path
+ result = getSamplingNode(root, 0, row);
+
+ if (result == root) {
+
+ // this means an empty row, so no node for it
+ result = null;
+
+ } else {
+
+ // found a row with a sampling, add it in cache
+ rowToNode.put(row, result);
+ nodeToRow.put(result, row);
+ }
+ }
+ return result;
+ }
+
+ protected SpeciesBatchTreeNode getSamplingNode(SpeciesBatchTreeNode node,
+ int samplingIndex,
+ SpeciesBatchRowModel row) {
+
+ String samplingKey = samplingOrder[samplingIndex];
+
+ Serializable samplingValue = (Serializable)
+ TuttiUIUtil.getProperty(row, samplingKey);
+
+ SpeciesBatchTreeNode result;
+
+ if (samplingValue == null) {
+
+ // was already on last sampling node
+ result = node;
+ } else {
+
+ result = node.getChild(samplingValue);
+
+ if (result == null) {
+
+ // new node, creates it and add it as child of current node
+ result = new SpeciesBatchTreeNode(samplingKey, samplingValue);
+ node.add(result);
+ }
+
+ if (samplingIndex < samplingOrder.length) {
+
+ // can try to find yet another sampling level
+ result = getSamplingNode(result, samplingIndex + 1, row);
+ }
+ }
+
+ return result;
+ }
+
+ public SamplingContext createSamplingContext(SpeciesBatchTreeNode rootNode) {
+
+ Set<SpeciesBatchRowModel> childRows = Sets.newHashSet();
+
+ SpeciesBatchRowModel superSamplingRow = getNodeToRow(rootNode);
+
+ float totalWeight = 0f;
+ for (int i = 0, nbChildren = rootNode.getChildCount(); i < nbChildren; i++) {
+ SpeciesBatchTreeNode node = rootNode.getChildAt(i);
+
+ SpeciesBatchRowModel row = getNodeToRow(node);
+ if (row != null) {
+ CaracteristicQualitativeValue sortedUnsortedCategory =
+ row.getSortedUnsortedCategory();
+ if (sortedUnsortedCategory != null &&
+ "unsorted".equals(sortedUnsortedCategory.getName())) {
+
+ // never take account of a such child
+
+ } else {
+
+ childRows.add(row);
+ Float weight = row.getWeight();
+ if (weight != null) {
+ totalWeight += weight;
+ }
+ }
+ }
+ }
+ SamplingContext result = new SamplingContext(rootNode,
+ superSamplingRow,
+ childRows,
+ totalWeight);
+ return result;
+ }
+
+ public SpeciesBatchRowModel getNodeToRow(SpeciesBatchTreeNode node) {
+ Collection<SpeciesBatchRowModel> rows = nodeToRow.get(node);
+
+ SpeciesBatchRowModel result = null;
+ if (CollectionUtils.isNotEmpty(rows)) {
+ for (SpeciesBatchRowModel next : rows) {
+ if (next.isValid()) {
+ result = next;
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ public boolean isValid(SpeciesBatchRowModel row, SpeciesBatchTreeNode newNode) {
+
+ // row must be on a sampling and having a weight
+ boolean result = row.getWeight() != null && newNode != null;
+
+ // make sure there is not already another row for this node
+ if (result && CollectionUtils.size(nodeToRow.get(newNode)) > 1) {
+ result = false;
+ }
+
+ return result;
+ }
+
+ public static class SamplingContext {
+
+ private final SpeciesBatchTreeNode rootNode;
+
+ private final SpeciesBatchRowModel superSamplingRow;
+
+ private final Set<SpeciesBatchRowModel> samplingRows;
+
+ private final float totalWeight;
+
+ public SamplingContext(SpeciesBatchTreeNode rootNode,
+ SpeciesBatchRowModel superSamplingRow,
+ Set<SpeciesBatchRowModel> samplingRows,
+ float totalWeight) {
+ this.rootNode = rootNode;
+ this.superSamplingRow = superSamplingRow;
+ this.samplingRows = samplingRows;
+ this.totalWeight = totalWeight;
+ }
+
+ public SpeciesBatchTreeNode getRootNode() {
+ return rootNode;
+ }
+
+ public SpeciesBatchRowModel getSuperSamplingRow() {
+ return superSamplingRow;
+ }
+
+ public Set<SpeciesBatchRowModel> getSamplingRows() {
+ return samplingRows;
+ }
+
+ public float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void applyNewSampleValues(float samplingWeight,
+ Float samplingRatio) {
+
+ for (SpeciesBatchRowModel row : samplingRows) {
+ row.setSampleWeight(samplingWeight);
+ row.setSamplingRatio(samplingRatio);
+ }
+ }
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/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/operation/catches/species/SpeciesBatchTreeNode.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTreeNode.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTreeNode.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,175 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.lang3.ObjectUtils;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeNode;
+import java.io.Serializable;
+import java.util.Arrays;
+
+/**
+ * Defines a node of a species catches sampling.
+ * <p/>
+ * A path in the tree gives a sampling path.
+ * <p/>
+ * UserObject is the {@code samplingValue}. It can be null only on root node.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+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 samplingKey;
+
+ public SpeciesBatchTreeNode() {
+ this(null, null);
+ }
+
+ public SpeciesBatchTreeNode(String samplingKey,
+ Serializable samplingValue) {
+ this.samplingKey = samplingKey;
+ setUserObject(samplingValue);
+ }
+
+ public String getSamplingPropertyKey() {
+ return samplingKey;
+ }
+
+ public boolean matchSamplingValue(Serializable value) {
+ Serializable samplingValue = getUserObject();
+
+ boolean result = ObjectUtils.equals(value, samplingValue);
+ return result;
+ }
+
+ public SpeciesBatchTreeNode getChild(Serializable samplingValue) {
+ SpeciesBatchTreeNode result = null;
+
+ for (int i = 0, max = getChildCount(); i < max; i++) {
+ SpeciesBatchTreeNode child = getChildAt(i);
+ if (child.matchSamplingValue(samplingValue)) {
+
+ // found matching child
+ result = child;
+ break;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public Serializable getUserObject() {
+ return (Serializable) super.getUserObject();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getChildAt(int index) {
+ return (SpeciesBatchTreeNode) super.getChildAt(index);
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getParent() {
+ return (SpeciesBatchTreeNode) super.getParent();
+ }
+
+ @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();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof SpeciesBatchTreeNode)) return false;
+
+ SpeciesBatchTreeNode that = (SpeciesBatchTreeNode) o;
+
+ Object[] path = getUserObjectPath();
+ Object[] path2 = that.getUserObjectPath();
+ return Arrays.equals(path, path2);
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTreeNode.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css (from rev 104, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,83 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#speciesTotalWeightLabel {
+ text: "tutti.label.catches.speciesTotalWeight";
+ labelFor: {speciesTotalWeightField};
+}
+
+#speciesTotalWeightField {
+ property: "speciesTotalWeight";
+ model: {model.getSpeciesTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#speciesTotalSortedWeightLabel {
+ text: "tutti.label.catches.speciesTotalSortedWeight";
+ labelFor: {speciesTotalSortedWeightField};
+}
+
+#speciesTotalSortedWeightField {
+ property: "speciesTotalSortedWeight";
+ model: {model.getSpeciesTotalSortedWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#speciesTotalSampleSortedWeightLabel {
+ text: "tutti.label.catches.speciesTotalSampleSortedWeight";
+ labelFor: {speciesTotalSampleSortedWeightField};
+}
+
+#speciesTotalSampleSortedWeightField {
+ property: "speciesTotalSampleSortedWeight";
+ model: {model.getSpeciesTotalSampleSortedWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#speciesTotalUnsortedWeightLabel {
+ text: "tutti.label.catches.speciesTotalUnsortedWeight";
+ labelFor: {speciesTotalUnsortedWeightField};
+}
+
+#speciesTotalUnsortedWeightField {
+ text: {getStringValue(model.getSpeciesTotalUnsortedWeight())};
+ editable: false;
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx (from rev 104, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,127 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a 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<SpeciesBatchUIModel, SpeciesBatchUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.ui.swing.TuttiUI
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
+ fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
+
+ org.jdesktop.swingx.JXTable
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.ListSelectionModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+ </import>
+
+ <script><![CDATA[
+
+public SpeciesBatchUI(TuttiUI<?,?> parentUI) {
+ JAXXUtil.initContext(this, parentUI);
+ SpeciesBatchUIHandler handler = new SpeciesBatchUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <SpeciesBatchUIHandler id='handler'
+ initializer='getContextValue(SpeciesBatchUIHandler.class)'/>
+
+ <SpeciesBatchUIModel id='model'
+ initializer='getContextValue(SpeciesBatchUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='speciesTotalWeight' component='speciesTotalWeightField'/>
+ <field name='speciesTotalSortedWeight'
+ component='speciesTotalSortedWeightField'/>
+ <field name='speciesTotalSampleSortedWeight'
+ component='speciesTotalSampleSortedWeightField'/>
+ <field name='speciesTotalUnsortedWeight'
+ component='speciesTotalUnsortedWeightField'/>
+ </BeanValidator>
+
+ <SpeciesFrequencyUI id='frequencyEditor'
+ constructorParams='handler.getContext()'/>
+
+ <LongTextEditorUI id='longTextEditor'/>
+
+ <AttachmentEditorUI id='attachmentEditor'/>
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total / Poids total vrac -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='speciesTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='speciesTotalWeightField' constructorParams='this'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='speciesTotalSortedWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='speciesTotalSortedWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids échantillonné vrac / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='speciesTotalSampleSortedWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='speciesTotalSampleSortedWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='speciesTotalUnsortedWeightLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='speciesTotalUnsortedWeightField'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event)'/>
+ </JScrollPane>
+
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,683 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
+import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesBatchUIHandler extends AbstractTuttiBatchTableUIHandler<SpeciesBatchRowModel, SpeciesBatchUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SpeciesBatchUIHandler.class);
+
+ public static final Set<String> RECOMPUTE_TOTAL_WEIGHT = Sets.newHashSet(
+ SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT);
+
+ public static final Set<String> SAMPLING_PROPERTIES = Sets.newHashSet(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SIZE_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_MATURITY_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_AGE);
+
+ /**
+ * UI.
+ *
+ * @since 0.2
+ */
+ private final SpeciesBatchUI ui;
+
+ public SpeciesBatchUIHandler(TuttiUI<?, ?> parentUi,
+ SpeciesBatchUI ui) {
+ super(parentUi,
+ SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SIZE_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_MATURITY_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_AGE,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT,
+ SpeciesBatchRowModel.PROPERTY_COMMENT,
+ SpeciesBatchRowModel.PROPERTY_ATTACHMENTS,
+ SpeciesBatchRowModel.PROPERTY_FREQUENCY);
+ this.ui = ui;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ protected SpeciesBatchUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ protected SpeciesBatchTableModel getTableModel() {
+ return (SpeciesBatchTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected FishingOperation getFishingOperation() {
+ return getModel().getFishingOperation();
+ }
+
+ @Override
+ protected void onModelRowsChanged(List<SpeciesBatchRowModel> rows) {
+ super.onModelRowsChanged(rows);
+
+ // build the new sampling tree from the new rows to edit
+ getModel().getSamplingTreeModel().populate(rows);
+ }
+
+ @Override
+ protected String[] getRowPropertiesToIgnore() {
+ return new String[]{
+ SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
+ SpeciesBatchRowModel.PROPERTY_FREQUENCY};
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ Decorator<CaracteristicQualitativeValue> caracteristicDecorator =
+ getDecorator(CaracteristicQualitativeValue.class, null);
+
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+
+ {
+ // Species (by code) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_BY_CODE,
+ decorator, allSpecies);
+ }
+
+ {
+ // Species (by genusCode) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
+ decorator, allSpecies);
+
+ }
+
+ {
+
+ // SortedUnsortedCategory column
+
+ Caracteristic data =
+ persistenceService.getSortedUnsortedCaracteristic();
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SORTED_UNSORTED_CATEGORY,
+ caracteristicDecorator,
+ data.getQualitativeValue());
+ }
+
+ {
+
+ // SizeCategory column
+
+ Caracteristic data =
+ persistenceService.getSizeCategoryCaracteristic();
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SIZE_CATEGORY,
+ caracteristicDecorator,
+ data.getQualitativeValue());
+ }
+
+ {
+
+ // SexCategory column
+
+ Caracteristic data = persistenceService.getSexCaracteristic();
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SEX_CATEGORY,
+ caracteristicDecorator,
+ data.getQualitativeValue());
+ }
+
+ {
+
+ // MaturityCategory column
+
+ Caracteristic data =
+ persistenceService.getMaturityCaracteristic();
+
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.MATURITY_CATEGORY,
+ caracteristicDecorator,
+ data.getQualitativeValue());
+ }
+
+ {
+
+ // Age column
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.AGE,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Weight column
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Computed weight column (from frequencies)
+
+ addColumnToModel(columnModel,
+ FrequencyCellComponent.newEditor(ui.getFrequencyEditor()),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchTableModel.COMPUTED_WEIGHT);
+ }
+
+ { // Computed number column (from frequencies)
+
+ addColumnToModel(columnModel,
+ FrequencyCellComponent.newEditor(ui.getFrequencyEditor()),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchTableModel.COMPUTED_NUMBER);
+ }
+
+ { // Sample weight column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.SAMPLE_WEIGHT);
+ }
+
+ { // SamplingRatio column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.SAMPLING_RATIO);
+ }
+
+ { // Comment column
+
+ addColumnToModel(columnModel,
+ LongTextCellComponent.newEditor(ui.getLongTextEditor()),
+ LongTextCellComponent.newRender(n_("tutti.tooltip.comment.none")),
+ SpeciesBatchTableModel.COMMENT);
+ }
+
+ { // File column
+
+ addColumnToModel(columnModel,
+ AttachmentCellComponent.newEditor(ui.getAttachmentEditor()),
+ AttachmentCellComponent.newRender(
+ getDecorator(Attachment.class, null),
+ n_("tutti.tooltip.attachment.none")),
+ SpeciesBatchTableModel.ATTACHMENTS);
+ }
+
+ { // Species to confirm column
+
+ addBooleanColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
+ getTable());
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(SpeciesBatchRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+
+ if (RECOMPUTE_TOTAL_WEIGHT.contains(propertyName)) {
+
+ // Need to recompute totalHorsVracWeight
+ recomputeTotalHorsVrac();
+ }
+
+ SpeciesBatchUIModel model = getModel();
+
+ SpeciesBatchTreeModel samplingTreeModel = model.getSamplingTreeModel();
+
+ if (SAMPLING_PROPERTIES.contains(propertyName)) {
+
+ // Need to rebuilt this row sampling tree path (and then recompute
+ // old super - samplingRatio and new super - samplingRatio)
+
+ // old node of the previous sampling def for this row
+ // and remove it from any cache
+ SpeciesBatchTreeNode oldNode = samplingTreeModel.removeNodeFromCache(row);
+
+ boolean rowWasValid = row.isValid();
+ if (oldNode != null && rowWasValid) {
+
+ // remove this row from his super sampling
+ recomputeSuperSamplingRatio(samplingTreeModel, oldNode);
+ }
+
+ // get new sampling node
+ SpeciesBatchTreeNode newNode = samplingTreeModel.getSamplingNode(row);
+
+ // check this row is valid
+ boolean rowValid = samplingTreeModel.isValid(row, newNode);
+
+ // push this state back to the row
+ row.setValid(rowValid);
+
+ if (rowValid) {
+
+ // can add it to his super-sampling
+ recomputeSuperSamplingRatio(samplingTreeModel, newNode);
+ } else {
+
+ if (rowWasValid) {
+
+ row.setSampleWeight(null);
+ row.setSamplingRatio(null);
+
+ getTableModel().updateSamplingRatio(Sets.newHashSet(row));
+ }
+ }
+ }
+
+ if (SpeciesBatchRowModel.PROPERTY_WEIGHT.equals(propertyName)) {
+
+ // Need to recompute the super - samplingRatio
+
+ SpeciesBatchTreeNode node = samplingTreeModel.getSamplingNode(row);
+
+ boolean rowWasValid = row.isValid();
+
+ // check this row is valid
+ boolean rowValid = samplingTreeModel.isValid(row, node);
+
+ // push this state back to the row
+ row.setValid(rowValid);
+
+ if (rowValid) {
+ recomputeSuperSamplingRatio(samplingTreeModel, node);
+ } else {
+ if (rowWasValid) {
+
+ // must remove this row from his super-sampling
+ recomputeSuperSamplingRatio(samplingTreeModel, node);
+
+ row.setSampleWeight(null);
+ row.setSamplingRatio(null);
+
+ getTableModel().updateSamplingRatio(Sets.newHashSet(row));
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void onRowValidStateChanged(SpeciesBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ int rowIndex = getTableModel().getRowIndex(row);
+
+ if (rowIndex > -1) {
+ getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
+ }
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(SpeciesBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
+ @Override
+ protected void saveSelectedRowIfRequired() {
+
+ TuttiBeanMonitor<SpeciesBatchRowModel> rowMonitor = getRowMonitor();
+
+ SpeciesBatchRowModel bean = rowMonitor.getBean();
+ if (bean != null) {
+
+ if (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();
+ }
+ } else {
+
+ // row is not valid can not save it
+
+ SpeciesBatch catchBean = bean.toBean();
+
+ if (!TuttiEntities.isNew(catchBean)) {
+
+ // remove this
+ persistenceService.deleteSpeciesBatch(catchBean.getId());
+ }
+ }
+ }
+ }
+
+ @Override
+ protected boolean isRowValid(SpeciesBatchRowModel row) {
+
+ SpeciesBatchUIModel model = getModel();
+
+ SpeciesBatchTreeModel samplingTreeModel = model.getSamplingTreeModel();
+ SpeciesBatchTreeNode node = samplingTreeModel.getSamplingNode(row);
+ boolean rowValid = samplingTreeModel.isValid(row, node);
+ return rowValid;
+ }
+
+ @Override
+ protected void saveRow(SpeciesBatchRowModel row) {
+
+ SpeciesBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
+ }
+
+ if (TuttiEntities.isNew(catchBean)) {
+
+ catchBean = persistenceService.createSpeciesBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.saveSpeciesBatch(catchBean);
+ }
+
+ List<SpeciesFrequencyRowModel> frequencyRows = row.getFrequency();
+
+ List<SpeciesBatchFrequency> frequency =
+ SpeciesFrequencyRowModel.toBeans(frequencyRows, catchBean);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will save " + frequency.size() + " frequencies.");
+ }
+ frequency = persistenceService.saveSpeciesBatchFrequency(
+ catchBean.getId(), frequency);
+
+ // push it back to row model
+ frequencyRows = SpeciesFrequencyRowModel.fromBeans(frequency);
+ row.setFrequency(frequencyRows);
+ }
+
+ @Override
+ public void selectFishingOperation(FishingOperation bean) {
+
+ JXTable table = ui.getTable();
+
+ if (table.isEditing()) {
+
+ // make sure to stop editor
+ table.editingCanceled(null);
+ }
+
+ // make sure selection is empty (will remove bean from monitor)
+ table.clearSelection();
+
+ boolean empty = bean == null;
+
+ SpeciesBatchUIModel model = getModel();
+
+ List<SpeciesBatchRowModel> rows;
+
+ if (empty) {
+ rows = null;
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species batch for fishingOperation: " +
+ bean.getId());
+ }
+ rows = Lists.newArrayList();
+
+ if (!TuttiEntities.isNew(bean)) {
+ List<SpeciesBatch> catches =
+ persistenceService.getAllSpeciesBatch(bean.getId());
+ for (SpeciesBatch aBatch : catches) {
+ List<SpeciesBatchFrequency> frequencies =
+ persistenceService.getAllSpeciesBatchFrequency(aBatch.getId());
+ SpeciesBatchRowModel entry =
+ new SpeciesBatchRowModel(aBatch, frequencies);
+ rows.add(entry);
+ }
+ }
+ }
+ model.setRows(rows);
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public void beforeInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("beforeInit: " + ui);
+ }
+
+ EditCatchesUIModel catchesUIModel =
+ ui.getContextValue(EditCatchesUIModel.class);
+
+ SpeciesBatchUIModel model = new SpeciesBatchUIModel(catchesUIModel);
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("afterInit: " + ui);
+ }
+
+ initUI(ui);
+
+ //TODO Will come from protocol
+ List<String> samplingOrder = Lists.newArrayList(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SIZE_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_MATURITY_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_AGE
+ );
+
+ getModel().setSamplingOrder(samplingOrder);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ SpeciesBatchTableModel tableModel =
+ new SpeciesBatchTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ initBatchTable(table, columnModel, tableModel);
+ }
+
+ @Override
+ public void onCloseUI() {
+ if (log.isInfoEnabled()) {
+ log.info("closing: " + ui);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+ protected void recomputeSuperSamplingRatio(SpeciesBatchTreeModel samplingTreeModel,
+ SpeciesBatchTreeNode node) {
+
+ SpeciesBatchTreeNode superSamplingNode = node.getParent();
+
+ Preconditions.checkNotNull(superSamplingNode,
+ "Super sampling node can't be null");
+
+ SpeciesBatchTreeModel.SamplingContext samplingContext =
+ samplingTreeModel.createSamplingContext(superSamplingNode);
+
+ float samplingTotalWeight = samplingContext.getTotalWeight();
+ Float superSamplingTotalWeight;
+ SpeciesBatchRowModel superSamplingRow =
+ samplingContext.getSuperSamplingRow();
+ if (superSamplingRow == null) {
+
+ // Use directly the batch total weight (means no super-sampling)
+
+ superSamplingTotalWeight = getModel().getSpeciesTotalWeight();
+ } else {
+ superSamplingTotalWeight = superSamplingRow.getWeight();
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("Super sampling total weight: " +
+ superSamplingTotalWeight);
+ }
+
+ Float samplingRatio = null;
+ if (superSamplingTotalWeight != null) {
+ samplingRatio = samplingTotalWeight / superSamplingTotalWeight;
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("Sampling ratio: " + samplingRatio);
+ }
+
+ samplingContext.applyNewSampleValues(samplingTotalWeight,
+ samplingRatio);
+
+ getTableModel().updateSamplingRatio(samplingContext.getSamplingRows());
+ }
+
+ protected void recomputeTotalHorsVrac() {
+
+ // recompute total hors vrac
+ Float totalHorsVrac = 0f;
+ Float totalVrac = 0f;
+
+ for (SpeciesBatchRowModel batch : getModel().getRows()) {
+ CaracteristicQualitativeValue vracHorsVrac =
+ batch.getSortedUnsortedCategory();
+
+ if (vracHorsVrac == null) {
+
+ // can't sum anything
+ } else {
+ boolean unsorted = "unsorted".equals(vracHorsVrac.getName());
+ if (unsorted) {
+ Float weight = batch.getWeight();
+ if (weight != null) {
+ totalHorsVrac += weight;
+ }
+ } else {
+ Float weight = batch.getWeight();
+ if (weight != null) {
+ totalVrac += weight;
+ }
+ }
+ }
+ }
+ if (log.isInfoEnabled()) {
+ log.info("New total vrac / hors vrac: " +
+ totalVrac + " / " + totalHorsVrac);
+ }
+ getModel().setSpeciesTotalUnsortedWeight(totalHorsVrac);
+ //TODO Should we also set the total vrac weight ?
+// getModel().setTotalVracWeight(totalVrac);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java (from rev 104, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,108 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesBatchUIModel extends AbstractTuttiBatchUIModel<SpeciesBatchRowModel, SpeciesBatchUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Sampling order (sets by protocol).
+ *
+ * @since 0.2
+ */
+ protected List<String> samplingOrder;
+
+ /**
+ * Tree of sampling for batch rows.
+ *
+ * @since 0.2
+ */
+ protected final SpeciesBatchTreeModel samplingTreeModel;
+
+ public SpeciesBatchUIModel(EditCatchesUIModel catchesUIModel) {
+ super(catchesUIModel,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_UNSORTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_WEIGHT);
+ this.samplingTreeModel = new SpeciesBatchTreeModel();
+ }
+
+ public Float getSpeciesTotalWeight() {
+ return catchesUIModel.getSpeciesTotalWeight();
+ }
+
+ public void setSpeciesTotalWeight(Float speciesTotalWeight) {
+ catchesUIModel.setSpeciesTotalWeight(speciesTotalWeight);
+ }
+
+ public Float getSpeciesTotalSortedWeight() {
+ return catchesUIModel.getSpeciesTotalSortedWeight();
+ }
+
+ public void setSpeciesTotalSortedWeight(Float speciesTotalSortedWeight) {
+ catchesUIModel.setSpeciesTotalSortedWeight(speciesTotalSortedWeight);
+ }
+
+ public Float getSpeciesTotalSampleSortedWeight() {
+ return catchesUIModel.getSpeciesTotalSampleSortedWeight();
+ }
+
+ public void setSpeciesTotalSampleSortedWeight(Float speciesSampleSortedWeight) {
+ catchesUIModel.setSpeciesTotalSampleSortedWeight(speciesSampleSortedWeight);
+ }
+
+ public Float getSpeciesTotalUnsortedWeight() {
+ return catchesUIModel.getSpeciesTotalUnsortedWeight();
+ }
+
+ public void setSpeciesTotalUnsortedWeight(Float speciesTotalUnsortedWeight) {
+ catchesUIModel.setSpeciesTotalUnsortedWeight(speciesTotalUnsortedWeight);
+ }
+
+ public SpeciesBatchTreeModel getSamplingTreeModel() {
+ return samplingTreeModel;
+ }
+
+ public List<String> getSamplingOrder() {
+ return samplingOrder;
+ }
+
+ public void setSamplingOrder(List<String> samplingOrder) {
+ this.samplingOrder = samplingOrder;
+ samplingTreeModel.setSamplingOrder(samplingOrder.toArray(new String[samplingOrder.size()]));
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyRowModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyRowModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,169 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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 com.google.common.collect.Ordering;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * Represents a batch frequency row.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBatchFrequency, SpeciesFrequencyRowModel> implements Comparable<SpeciesFrequencyRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_LENGTH_STEP = "lengthStep";
+
+ public static final String PROPERTY_NUMBER = "number";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight";
+
+ /**
+ * Length step.
+ *
+ * @since 0.2
+ */
+ protected Float lengthStep;
+
+ /**
+ * Count of fishes for this lengthStep.
+ *
+ * @since 0.2
+ */
+ protected Integer number;
+
+ /**
+ * Weight of fishes observed.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Computed weight from number + relation taille-poids.
+ *
+ * @since 0.2
+ */
+ protected Float computedWeight;
+
+ protected static final Binder<SpeciesBatchFrequency, SpeciesFrequencyRowModel> fromBeanBinder =
+ BinderFactory.newBinder(SpeciesBatchFrequency.class,
+ SpeciesFrequencyRowModel.class);
+
+ protected static final Binder<SpeciesFrequencyRowModel, SpeciesBatchFrequency> toBeanBinder =
+ BinderFactory.newBinder(SpeciesFrequencyRowModel.class,
+ SpeciesBatchFrequency.class);
+
+ private static final Ordering<Float> ordering = Ordering.natural().nullsFirst();
+
+ public static List<SpeciesFrequencyRowModel> fromBeans(List<SpeciesBatchFrequency> frequency) {
+ List<SpeciesFrequencyRowModel> result = Lists.newArrayList();
+ for (SpeciesBatchFrequency b : frequency) {
+ SpeciesFrequencyRowModel model = new SpeciesFrequencyRowModel();
+ fromBeanBinder.copy(b, model);
+ result.add(model);
+ }
+ return result;
+ }
+
+ public static List<SpeciesBatchFrequency> toBeans(List<SpeciesFrequencyRowModel> frequency, SpeciesBatch batch) {
+ List<SpeciesBatchFrequency> result = Lists.newArrayList();
+ for (SpeciesFrequencyRowModel b : frequency) {
+ SpeciesBatchFrequency model = new SpeciesBatchFrequency();
+ toBeanBinder.copy(b, model);
+ model.setBatch(batch);
+ result.add(model);
+ }
+ return result;
+ }
+
+ public SpeciesFrequencyRowModel() {
+ super(SpeciesBatchFrequency.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public Float getLengthStep() {
+ return lengthStep;
+ }
+
+ public void setLengthStep(Float lengthStep) {
+ Object oldValue = getLengthStep();
+ this.lengthStep = lengthStep;
+ firePropertyChange(PROPERTY_LENGTH_STEP, oldValue, lengthStep);
+ }
+
+ public Integer getNumber() {
+ return number;
+ }
+
+ public void setNumber(Integer number) {
+ Object oldValue = getNumber();
+ this.number = number;
+ firePropertyChange(PROPERTY_NUMBER, oldValue, number);
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public Float getComputedWeight() {
+ return computedWeight;
+ }
+
+ public void setComputedWeight(Float computedWeight) {
+ Object oldValue = getComputedWeight();
+ this.computedWeight = computedWeight;
+ firePropertyChange(PROPERTY_COMPUTED_WEIGHT, oldValue, computedWeight);
+ }
+
+ //TODO Use validator
+ @Override
+ public boolean isValid() {
+ return lengthStep != null && number != null;
+ }
+
+ @Override
+ public int compareTo(SpeciesFrequencyRowModel o) {
+ int result = ordering.compare(lengthStep, o.lengthStep);
+ return result;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyTableModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyTableModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,146 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.Maps;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Model of the species frequency table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyTableModel extends AbstractTuttiTableModel<SpeciesFrequencyRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> LENGTH_STEP = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_LENGTH_STEP,
+ n_("tutti.table.species.frequency.header.lengthStep"),
+ n_("tutti.table.species.frequency.header.lengthStep"));
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> NUMBER = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_NUMBER,
+ n_("tutti.table.species.frequency.header.number"),
+ n_("tutti.table.species.frequency.header.number"));
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> WEIGHT = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.species.frequency.header.weight"),
+ n_("tutti.table.species.frequency.header.weight"));
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_COMPUTED_WEIGHT,
+ n_("tutti.table.species.frequency.header.computedWeight"),
+ n_("tutti.table.species.frequency.header.computedWeight"));
+
+ private final SpeciesFrequencyUIModel uiModel;
+
+ private final Map<Float, SpeciesFrequencyRowModel> rowCache;
+
+ public SpeciesFrequencyTableModel(TableColumnModel columnModel,
+ SpeciesFrequencyUIModel uiModel) {
+ super(columnModel);
+ this.uiModel = uiModel;
+ this.rowCache = Maps.newTreeMap();
+ setNoneEditableCols(COMPUTED_WEIGHT);
+ }
+
+ @Override
+ protected SpeciesFrequencyRowModel createNewRow() {
+ Float defaultStep = null;
+
+ int rowCount = getRowCount();
+ if (rowCount > 0) {
+
+ SpeciesFrequencyRowModel rowModel = getEntry(rowCount - 1);
+ Float lengthStep = rowModel.getLengthStep();
+ if (lengthStep != null) {
+ defaultStep = uiModel.getLengthStep(
+ lengthStep + uiModel.getStep());
+ }
+ }
+ SpeciesFrequencyRowModel result = new SpeciesFrequencyRowModel();
+ result.setLengthStep(defaultStep);
+ result.setValid(false);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<SpeciesFrequencyRowModel> propertyName,
+ SpeciesFrequencyRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+ // TODO Rebuild the computedWeight if possible...
+ }
+
+ public Map<Float, SpeciesFrequencyRowModel> getRowCache() {
+ return rowCache;
+ }
+
+ @Override
+ protected void onRowsChanged(List<SpeciesFrequencyRowModel> data) {
+
+ // rebuild row cache
+ rowCache.clear();
+
+ for (SpeciesFrequencyRowModel row : data) {
+ Float lengthStep = row.getLengthStep();
+ if (lengthStep != null) {
+ rowCache.put(lengthStep, row);
+ }
+ }
+ }
+
+ @Override
+ protected void onRowAdded(int rowIndex, SpeciesFrequencyRowModel newValue) {
+
+ Preconditions.checkNotNull(newValue, "can't add a null row");
+
+ // add new row to cache
+ Float lengthStep = newValue.getLengthStep();
+
+ Preconditions.checkNotNull(lengthStep,
+ "can't add a null lengthStep row");
+
+ float roundLenghtValue = uiModel.getLengthStep(lengthStep);
+
+ if (!rowCache.containsKey(roundLenghtValue)) {
+
+ rowCache.put(roundLenghtValue, newValue);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.css (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.css 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,142 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+}
+
+#stepLabel {
+ text: "tutti.label.frequencyConfiguration.step";
+ labelFor: {stepField};
+}
+
+#stepField {
+ property: "step";
+ model: {model.getStep()};
+ useFloat: true;
+ numberPattern: {DECIMAL1_PATTERN};
+ bean: {model};
+}
+
+#minStepLabel {
+ text: "tutti.label.frequencyConfiguration.minStep";
+ labelFor: {minStepField};
+}
+
+#minStepField {
+ property: "minStep";
+ model: {model.getMinStep()};
+ useFloat: true;
+ showReset: true;
+ numberPattern: {DECIMAL1_PATTERN};
+ bean: {model};
+}
+
+#maxStepLabel {
+ text: "tutti.label.frequencyConfiguration.maxStep";
+ labelFor: {maxStepField};
+}
+
+#maxStepField {
+ property: "maxStep";
+ model: {model.getMaxStep()};
+ useFloat: true;
+ showReset: true;
+ numberPattern: {DECIMAL1_PATTERN};
+ bean: {model};
+}
+
+#rafaleStepLabel {
+ text: "tutti.label.frequencyConfiguration.rafaleStep";
+ labelFor: {rafaleStepField};
+}
+
+#rafaleStepField {
+ modelType: {Float.class};
+ useFloat: true;
+ showReset: true;
+ numberPattern: {DECIMAL1_PATTERN};
+}
+
+#generateButton {
+ actionIcon: "generate";
+ text: "tutti.action.generate";
+ enabled: {model.isCanGenerate()};
+}
+
+#configurationPanel {
+ border: {new TitledBorder(null, _("tutti.legend.frequencyConfiguration"))};
+}
+
+#modeConfigurationLayout {
+ selected: {String.valueOf(mode.getSelectedValue())};
+}
+
+#modeConfigurationPanel {
+ layout: {modeConfigurationLayout};
+}
+
+#simpleModeButton {
+ text: "tutti.label.frequencyConfiguration.mode.simple";
+ toolTipText: "tutti.label.frequencyConfiguration.mode.simple.tip";
+ value: "simpleMode";
+ selected: {model.isSimpleMode()};
+ buttonGroup: "mode";
+}
+
+#simpleModeLabel {
+ text: "tutti.label.frequencyConfiguration.no.configuration";
+ horizontalAlignment: {JLabel.CENTER};
+ enabled: false;
+}
+
+#autoGenModeButton {
+ text: "tutti.label.frequencyConfiguration.mode.autoGen";
+ toolTipText: "tutti.label.frequencyConfiguration.mode.autoGen.tip";
+ value: "autoGenMode";
+ selected: {model.isAutoGenMode()};
+ buttonGroup: "mode";
+}
+
+#rafaleModeButton {
+ text: "tutti.label.frequencyConfiguration.mode.rafale";
+ toolTipText: "tutti.label.frequencyConfiguration.mode.rafale.tip";
+ value: "rafaleMode";
+ selected: {model.isRafaleMode()};
+ buttonGroup: "mode";
+}
+
+#closeButton {
+ actionIcon: "close";
+ text: "tutti.action.close";
+ mnemonic: F;
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.jaxx (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.jaxx 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,167 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesFrequencyUIModel, SpeciesFrequencyUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.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[
+
+ public SpeciesFrequencyUI(TuttiUIContext context) {
+ SpeciesFrequencyUIHandler handler = new SpeciesFrequencyUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ public void editBatch(SpeciesBatchRowModel row) {
+ handler.editBatch(row);
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <SpeciesFrequencyUIHandler id='handler'
+ initializer='getContextValue(SpeciesFrequencyUIHandler.class)'/>
+
+ <SpeciesFrequencyUIModel id='model'
+ initializer='getContextValue(SpeciesFrequencyUIModel.class)'/>
+
+ <CardLayout2Ext id='modeConfigurationLayout'
+ constructorParams='this, "modeConfigurationPanel"'/>
+
+ <JPanel id='configurationPanel' layout='{new BorderLayout()}' constraints='BorderLayout.NORTH'>
+
+ <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.CENTER'>
+ <VBox id='modePanel' constraints='BorderLayout.WEST'
+ verticalAlignment='{SwingConstants.CENTER}'>
+ <JRadioButton id='simpleModeButton'
+ onActionPerformed='model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE)'/>
+ <JRadioButton id='autoGenModeButton'
+ onActionPerformed='model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.AUTO_GEN)'/>
+ <JRadioButton id='rafaleModeButton'
+ onActionPerformed='model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.RAFALE)'/>
+ </VBox>
+
+ <JPanel id='modeConfigurationPanel' constraints='BorderLayout.CENTER'>
+ <JPanel id='simpleModePanel' constraints='"simpleMode"'
+ layout='{new BorderLayout()}'>
+ <JLabel id='simpleModeLabel' constraints='BorderLayout.CENTER'/>
+ </JPanel>
+ <JPanel id='autoGenModePanel' constraints='"autoGenMode"'>
+ <Table fill='both' constraints='BorderLayout.SOUTH'>
+ <!-- Min step-->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='minStepLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='minStepField' constructorParams='this'/>
+ </cell>
+ </row>
+ <!-- Max step-->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='maxStepLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='maxStepField' constructorParams='this'/>
+ </cell>
+ </row>
+ <!-- Actions -->
+ <row>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JButton id='generateButton'
+ onActionPerformed='handler.generateLengthSteps()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ <JPanel id='rafaleModePanel' constraints='"rafaleMode"'>
+ <Table fill='both' constraints='BorderLayout.SOUTH'>
+ <!-- Rafale step-->
+ <row>
+ <cell weightx='1.0'>
+ <JLabel id='rafaleStepLabel'/>
+ </cell>
+ </row>
+ <row>
+ <cell weightx='1.0'>
+ <NumberEditor id='rafaleStepField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </JPanel>
+ </JPanel>
+ <Table fill='both' constraints='BorderLayout.SOUTH'>
+ <row>
+ <cell columns='2'>
+ <JSeparator/>
+ </cell>
+ </row>
+ <!-- Step -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='stepLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='stepField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table'/>
+ </JScrollPane>
+
+ <!-- actions -->
+ <JPanel id='actionPanel' layout='{new GridLayout(1, 0)}'
+ constraints='BorderLayout.SOUTH'>
+ <JButton id='closeButton' onActionPerformed='handler.close()'/>
+ </JPanel>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIHandler.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIHandler.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,362 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+
+import javax.swing.JDialog;
+import javax.swing.table.TableColumnModel;
+import java.awt.Color;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<SpeciesFrequencyRowModel, SpeciesFrequencyUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SpeciesFrequencyUIHandler.class);
+
+ private final SpeciesFrequencyUI ui;
+
+ public SpeciesFrequencyUIHandler(TuttiUIContext context,
+ SpeciesFrequencyUI ui) {
+ super(context,
+ SpeciesFrequencyRowModel.PROPERTY_LENGTH_STEP,
+ SpeciesFrequencyRowModel.PROPERTY_NUMBER,
+ SpeciesFrequencyRowModel.PROPERTY_WEIGHT,
+ SpeciesFrequencyRowModel.PROPERTY_COMPUTED_WEIGHT);
+ this.ui = ui;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ protected SpeciesFrequencyUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ protected SpeciesFrequencyTableModel getTableModel() {
+ return (SpeciesFrequencyTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
+
+ { // LengthStep
+
+ addFloatColumnToModel(columnModel,
+ SpeciesFrequencyTableModel.LENGTH_STEP,
+ TuttiUI.DECIMAL1_PATTERN);
+ }
+
+ { // Number
+
+ addIntegerColumnToModel(columnModel,
+ SpeciesFrequencyTableModel.NUMBER,
+ TuttiUI.INT_6_DIGITS_PATTERN);
+ }
+
+ { // Weight
+
+ addFloatColumnToModel(columnModel,
+ SpeciesFrequencyTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // ComputedWeight
+
+ addFloatColumnToModel(columnModel,
+ SpeciesFrequencyTableModel.COMPUTED_WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(SpeciesFrequencyRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+ if (SpeciesFrequencyRowModel.PROPERTY_NUMBER.equals(propertyName)) {
+
+ // Need to recompute the computedWeight
+ computeComputedWeight(row);
+ }
+ }
+
+ @Override
+ protected void onRowValidStateChanged(SpeciesFrequencyRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(SpeciesFrequencyRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public void beforeInitUI() {
+
+ SpeciesFrequencyUIModel model = new SpeciesFrequencyUIModel();
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ SpeciesFrequencyUIModel model = getModel();
+
+ // create table model
+ SpeciesFrequencyTableModel tableModel =
+ new SpeciesFrequencyTableModel(columnModel, model);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ installTableKeyListener(columnModel, table);
+
+ table.getTableHeader().setReorderingAllowed(false);
+
+ table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(
+ HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
+
+ // when model datas change let's propagate it table model
+ listenRowsFromModel();
+
+ //TODO Should it come from PROTOCOL or config ?
+ model.setStep(.5f);
+
+ model.setMinStep(10f);
+ model.setMaxStep(20f);
+
+ //TODO Configure this ?
+ model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE);
+
+ // always scroll to selected row
+ SwingUtil.scrollToTableSelection(getTable());
+
+ ui.getRafaleStepField().getTextField().addKeyListener(new KeyAdapter() {
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+ e.consume();
+ Float step = (Float) ui.getRafaleStepField().getModel();
+
+ applyRafaleStep(step);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
+ public void generateLengthSteps() {
+
+ SpeciesFrequencyUIModel model = getModel();
+
+ Map<Float, SpeciesFrequencyRowModel> rowsByStep =
+ getTableModel().getRowCache();
+
+ Float minStep = model.getLengthStep(model.getMinStep());
+ Float maxStep = model.getLengthStep(model.getMaxStep());
+
+ for (float i = minStep, step = model.getStep(); i <= maxStep; i += step) {
+ if (!rowsByStep.containsKey(i)) {
+
+ // add it
+ SpeciesFrequencyRowModel newRow = new SpeciesFrequencyRowModel();
+ newRow.setLengthStep(i);
+ rowsByStep.put(i, newRow);
+ }
+ }
+
+ List<SpeciesFrequencyRowModel> rows =
+ Lists.newArrayList(rowsByStep.values());
+
+ model.setRows(rows);
+ }
+
+ public void applyRafaleStep(Float step) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Will apply rafale step: " + step);
+ }
+ SpeciesFrequencyUIModel model = getModel();
+ SpeciesFrequencyTableModel tableModel = getTableModel();
+
+ Map<Float, SpeciesFrequencyRowModel> rowsByStep = tableModel.getRowCache();
+
+ float aroundLengthStep = model.getLengthStep(step);
+
+ SpeciesFrequencyRowModel row = rowsByStep.get(aroundLengthStep);
+
+ int rowIndex;
+
+ if (row != null) {
+
+ // increments current row
+ Integer number = row.getNumber();
+ row.setNumber((number == null ? 0 : number) + 1);
+ rowIndex = tableModel.updateRow(row);
+
+ } else {
+
+ // create a new row
+ row = new SpeciesFrequencyRowModel();
+ row.setLengthStep(aroundLengthStep);
+ row.setNumber(1);
+
+ // get new index
+ List<Float> steps = Lists.newArrayList(rowsByStep.keySet());
+ steps.add(aroundLengthStep);
+
+ Collections.sort(steps);
+
+ rowIndex = steps.indexOf(aroundLengthStep);
+
+ tableModel.addNewRow(rowIndex, row);
+ }
+
+ getTable().scrollRowToVisible(rowIndex);
+ }
+
+ public void editBatch(SpeciesBatchRowModel row) {
+
+ List<SpeciesFrequencyRowModel> frequency = null;
+ if (row != null) {
+ frequency = row.getFrequency();
+ }
+
+ List<SpeciesFrequencyRowModel> editFrequency;
+ if (CollectionUtils.isEmpty(frequency)) {
+
+ // new list
+ editFrequency = Lists.newArrayList();
+ } else {
+
+ editFrequency = Lists.newArrayList(frequency);
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("Will edit batch row: " + row + " with " +
+ editFrequency.size() + " frequency");
+ }
+ getModel().setRows(editFrequency);
+
+ // keep batch (will be used to push back editing entry)
+ getModel().setBatch(row);
+ }
+
+ public void close() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Will close UI " + ui);
+ }
+
+ // transfer rows to editor
+
+ List<SpeciesFrequencyRowModel> frequency = Lists.newArrayList();
+ for (SpeciesFrequencyRowModel row : getModel().getRows()) {
+ if (row.isValid()) {
+
+ // can keep this row
+ frequency.add(row);
+ }
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("Push back " + frequency.size() +
+ " frequency to batch " + getModel().getBatch());
+ }
+
+ // push back to batch
+ getModel().getBatch().setFrequency(frequency);
+
+ ui.editBatch(null);
+
+ SwingUtil.getParentContainer(ui, JDialog.class).setVisible(false);
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+ protected void computeComputedWeight(SpeciesFrequencyRowModel row) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Will recompute computed weight for frequency: " + row);
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIModel.java (from rev 103, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -0,0 +1,174 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.util.table.AbstractTuttiTableUIModel;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyUIModel extends AbstractTuttiTableUIModel<SpeciesBatchRowModel, SpeciesFrequencyRowModel, SpeciesFrequencyUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_CONFIGURATION_MODE = "configurationMode";
+
+ public static final String PROPERTY_STEP = "step";
+
+ private static final String PROPERTY_MIN_STEP = "minStep";
+
+ private static final String PROPERTY_MAX_STEP = "maxStep";
+
+ public static final String PROPERTY_CAN_GENERATE = "canGenerate";
+
+ public static final String PROPERTY_SIMPLE_MODE = "simpleMode";
+
+ public static final String PROPERTY_AUTO_GEN_MODE = "autoGenMode";
+
+ public static final String PROPERTY_RAFALE_MODE = "rafaleMode";
+
+ public static enum ConfigurationMode {
+ SIMPLE,
+ AUTO_GEN,
+ RAFALE
+ }
+
+ /**
+ * Fill mode.
+ *
+ * @since 0.2
+ */
+ protected ConfigurationMode configurationMode;
+
+ /**
+ * Batch that contains frequencies.
+ *
+ * @since 0.2
+ */
+ protected SpeciesBatchRowModel batch;
+
+ /**
+ * Default step to increment length step.
+ *
+ * @since 0.2
+ */
+ protected float step;
+
+ /**
+ * Min step to auto generate length steps.
+ *
+ * @since 0.2
+ */
+ protected Float minStep;
+
+ /**
+ * Max step to auto generate length steps.
+ *
+ * @since 0.2
+ */
+ protected Float maxStep;
+
+ public SpeciesFrequencyUIModel() {
+ super(SpeciesBatchRowModel.class, null, null);
+ }
+
+ public ConfigurationMode getConfigurationMode() {
+ return configurationMode;
+ }
+
+ public void setConfigurationMode(ConfigurationMode configurationMode) {
+ Object oldValue = getConfigurationMode();
+ this.configurationMode = configurationMode;
+ firePropertyChange(PROPERTY_CONFIGURATION_MODE, oldValue, configurationMode);
+ firePropertyChange(PROPERTY_SIMPLE_MODE, null, isSimpleMode());
+ firePropertyChange(PROPERTY_AUTO_GEN_MODE, null, isAutoGenMode());
+ firePropertyChange(PROPERTY_RAFALE_MODE, null, isRafaleMode());
+ }
+
+ public float getStep() {
+ return step;
+ }
+
+ public void setStep(float step) {
+ Object oldValue = getStep();
+ this.step = step;
+ firePropertyChange(PROPERTY_STEP, oldValue, step);
+ }
+
+ public Float getMinStep() {
+ return minStep;
+ }
+
+ public void setMinStep(Float minStep) {
+ Object oldValue = getMinStep();
+ this.minStep = minStep;
+ firePropertyChange(PROPERTY_MIN_STEP, oldValue, minStep);
+ firePropertyChange(PROPERTY_CAN_GENERATE, null, isCanGenerate());
+ }
+
+ public Float getMaxStep() {
+ return maxStep;
+ }
+
+ public void setMaxStep(Float maxStep) {
+ Object oldValue = getMaxStep();
+ this.maxStep = maxStep;
+ firePropertyChange(PROPERTY_MAX_STEP, oldValue, maxStep);
+ firePropertyChange(PROPERTY_CAN_GENERATE, null, isCanGenerate());
+ }
+
+ public boolean isSimpleMode() {
+ return ConfigurationMode.SIMPLE == configurationMode;
+ }
+
+ public boolean isAutoGenMode() {
+ return ConfigurationMode.AUTO_GEN == configurationMode;
+ }
+
+ public boolean isRafaleMode() {
+ return ConfigurationMode.RAFALE == configurationMode;
+ }
+
+ public boolean isCanGenerate() {
+ return minStep != null && maxStep != null && maxStep > minStep;
+ }
+
+ public SpeciesBatchRowModel getBatch() {
+ return batch;
+ }
+
+ public void setBatch(SpeciesBatchRowModel batch) {
+ this.batch = batch;
+ }
+
+ public float getLengthStep(float lengthStep) {
+ int intValue = (int) (lengthStep * 10);
+ int intStep = (int) (step * 10);
+ int correctIntStep = intValue - (intValue % intStep);
+ float result = correctIntStep / 10f;
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesFrequencyUIModel.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/operation/macrowaste/MacroWasteBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchRowModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchRowModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,138 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.Attachment;
-import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
-import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * Define a benthos batch row.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MacroWasteBatchRowModel extends AbstractTuttiBeanUIModel<MacroWasteBatch, MacroWasteBatchRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_MACRO_WASTE_CATEGORY = "macroWasteCategory";
-
- public static final String PROPERTY_WEIGHT = "weight";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_ATTACHMENTS = "attachments";
-
- /**
- * macroWaste category.
- *
- * @since 0.2
- */
- protected CaracteristicQualitativeValue macroWasteCategory;
-
- /**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- /**
- * Comment on this batch.
- *
- * @since 0.2
- */
- protected String comment;
-
- /**
- * Attachments.
- *
- * @since 0.2
- */
- protected List<Attachment> attachments;
-
- protected static final Binder<MacroWasteBatch, MacroWasteBatchRowModel> fromBeanBinder =
- BinderFactory.newBinder(MacroWasteBatch.class,
- MacroWasteBatchRowModel.class);
-
- protected static final Binder<MacroWasteBatchRowModel, MacroWasteBatch> toBeanBinder =
- BinderFactory.newBinder(MacroWasteBatchRowModel.class,
- MacroWasteBatch.class);
-
- public MacroWasteBatchRowModel() {
- super(MacroWasteBatch.class, fromBeanBinder, toBeanBinder);
- }
-
- public MacroWasteBatchRowModel(MacroWasteBatch aBatch) {
- this();
- fromBean(aBatch);
- }
-
- public CaracteristicQualitativeValue getMacroWasteCategory() {
- return macroWasteCategory;
- }
-
- public void setMacroWasteCategory(CaracteristicQualitativeValue macroWasteCategory) {
- Object oldValue = getMacroWasteCategory();
- this.macroWasteCategory = macroWasteCategory;
- firePropertyChange(PROPERTY_MACRO_WASTE_CATEGORY, oldValue, macroWasteCategory);
- }
-
- public Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- Object oldValue = getWeight();
- this.weight = weight;
- firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public List<Attachment> getAttachments() {
- return attachments;
- }
-
- public void setAttachments(List<Attachment> attachments) {
- Object oldValue = getAttachments();
- this.attachments = attachments;
- firePropertyChange(PROPERTY_ATTACHMENTS, oldValue, attachments);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchTableModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchTableModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,77 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-
-import javax.swing.table.TableColumnModel;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MacroWasteBatchTableModel extends AbstractTuttiTableModel<MacroWasteBatchRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final ColumnIdentifier<MacroWasteBatchRowModel> MACRO_WASTE_CATEGORY = ColumnIdentifier.newId(
- MacroWasteBatchRowModel.PROPERTY_MACRO_WASTE_CATEGORY,
- n_("tutti.table.macrowaste.batch.header.macroWasteCategory"),
- n_("tutti.table.macrowaste.batch.header.macroWasteCategory"));
-
- public static final ColumnIdentifier<MacroWasteBatchRowModel> WEIGHT = ColumnIdentifier.newId(
- MacroWasteBatchRowModel.PROPERTY_WEIGHT,
- n_("tutti.table.macrowaste.batch.header.weight"),
- n_("tutti.table.macrowaste.batch.header.weight"));
-
- public static final ColumnIdentifier<MacroWasteBatchRowModel> COMMENT = ColumnIdentifier.newId(
- MacroWasteBatchRowModel.PROPERTY_COMMENT,
- n_("tutti.table.macrowaste.batch.header.comment"),
- n_("tutti.table.macrowaste.batch.header.comment"));
-
- public static final ColumnIdentifier<MacroWasteBatchRowModel> ATTACHMENTS = ColumnIdentifier.newId(
- MacroWasteBatchRowModel.PROPERTY_ATTACHMENTS,
- n_("tutti.table.macrowaste.batch.header.file"),
- n_("tutti.table.macrowaste.batch.header.file"));
-
- public MacroWasteBatchTableModel(TableColumnModel columnModel) {
- super(columnModel);
-
- setNoneEditableCols();
- }
-
- @Override
- protected MacroWasteBatchRowModel createNewRow() {
- MacroWasteBatchRowModel result = new MacroWasteBatchRowModel();
-
- // by default empty row is not valid
- result.setValid(false);
- return result;
- }
-
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,49 +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;
-}
-
-#macroWasteTotalWeightLabel {
- text: "tutti.label.catches.macroWasteTotalWeight";
- labelFor: {macroWasteTotalWeightField};
-}
-
-#macroWasteTotalWeightField {
- property: "macroWasteTotalWeight";
- model: {model.getMacroWasteTotalWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#table {
- selectionMode: {ListSelectionModel.SINGLE_SELECTION};
- selectionBackground: {null};
- selectionForeground: {Color.BLACK};
- sortable: false;
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,95 +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<MacroWasteBatchUIModel, MacroWasteBatchUIHandler>'>
-
- <import>
- fr.ifremer.tutti.ui.swing.TuttiUI
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
- fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- org.jdesktop.swingx.JXTable
-
- javax.swing.ListSelectionModel
-
- java.awt.Color
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public MacroWasteBatchUI(TuttiUI<?,?> parentUI) {
- JAXXUtil.initContext(this, parentUI);
- MacroWasteBatchUIHandler handler = new MacroWasteBatchUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <MacroWasteBatchUIHandler id='handler'
- initializer='getContextValue(MacroWasteBatchUIHandler.class)'/>
-
- <MacroWasteBatchUIModel id='model'
- initializer='getContextValue(MacroWasteBatchUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='macroWasteTotalWeight' component='macroWasteTotalWeightField'/>
- </BeanValidator>
-
- <LongTextEditorUI id='longTextEditor'/>
-
- <AttachmentEditorUI id='attachmentEditor'/>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='macroWasteTotalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='macroWasteTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JXTable id='table'
- onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
- </JScrollPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,353 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.Attachment;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
-import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.ui.swing.TuttiUI;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
-import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
-import org.nuiton.util.decorator.Decorator;
-
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MacroWasteBatchUIHandler extends AbstractTuttiBatchTableUIHandler<MacroWasteBatchRowModel, MacroWasteBatchUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(MacroWasteBatchUIHandler.class);
-
- /**
- * UI.
- *
- * @since 0.2
- */
- private final MacroWasteBatchUI ui;
-
- public MacroWasteBatchUIHandler(TuttiUI<?, ?> parentUi, MacroWasteBatchUI ui) {
- super(parentUi,
- MacroWasteBatchRowModel.PROPERTY_MACRO_WASTE_CATEGORY,
- MacroWasteBatchRowModel.PROPERTY_WEIGHT,
- MacroWasteBatchRowModel.PROPERTY_COMMENT);
- this.ui = ui;
- }
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiTableUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- protected MacroWasteBatchUIModel getModel() {
- return ui.getModel();
- }
-
- @Override
- protected MacroWasteBatchTableModel getTableModel() {
- return (MacroWasteBatchTableModel) getTable().getModel();
- }
-
- @Override
- protected JXTable getTable() {
- return ui.getTable();
- }
-
- @Override
- protected FishingOperation getFishingOperation() {
- return getModel().getFishingOperation();
- }
-
- @Override
- protected TableColumnModel createTableColumnModel() {
-
- DefaultTableColumnModelExt columnModel =
- new DefaultTableColumnModelExt();
-
- {
- // MacroWaste Category column
-
- Decorator<CaracteristicQualitativeValue> decorator = getDecorator(
- CaracteristicQualitativeValue.class, null);
-
- addComboDataColumnToModel(columnModel,
- MacroWasteBatchTableModel.MACRO_WASTE_CATEGORY,
- decorator, persistenceService.getMacroWasteCategoryCaracteristic().getQualitativeValue());
- }
-
- { // Weight column
-
- addFloatColumnToModel(columnModel,
- MacroWasteBatchTableModel.WEIGHT,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Comment column
-
- addColumnToModel(columnModel,
- LongTextCellComponent.newEditor(ui.getLongTextEditor()),
- LongTextCellComponent.newRender(n_("tutti.tooltip.comment.none")),
- MacroWasteBatchTableModel.COMMENT);
- }
-
- { // File column
-
- addColumnToModel(columnModel,
- AttachmentCellComponent.newEditor(ui.getAttachmentEditor()),
- AttachmentCellComponent.newRender(
- getDecorator(Attachment.class, null),
- n_("tutti.tooltip.attachment.none")),
- MacroWasteBatchTableModel.ATTACHMENTS);
- }
- return columnModel;
- }
-
- @Override
- protected void onRowModified(MacroWasteBatchRowModel row,
- String propertyName,
- Object oldValue,
- Object newValue) {
-
- boolean wasValid = row.isValid();
-
- boolean valid = isRowValid(row);
-
- if (log.isInfoEnabled()) {
- log.info("Was valid / Is valid: " + wasValid + " / " + valid);
- }
- row.setValid(valid);
- }
-
- @Override
- protected void onRowValidStateChanged(MacroWasteBatchRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- int rowIndex = getTableModel().getRowIndex(row);
-
- if (rowIndex > -1) {
- getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
- }
- }
-
- @Override
- protected void onRowModifyStateChanged(MacroWasteBatchRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- }
-
- @Override
- protected void onModelRowsChanged(List<MacroWasteBatchRowModel> rows) {
- super.onModelRowsChanged(rows);
-
- // set valid flag
- for (MacroWasteBatchRowModel row : rows) {
- boolean valid = isRowValid(row);
- row.setValid(valid);
- }
- }
-
- @Override
- protected void saveSelectedRowIfRequired() {
-
- TuttiBeanMonitor<MacroWasteBatchRowModel> rowMonitor = getRowMonitor();
-
- MacroWasteBatchRowModel bean = rowMonitor.getBean();
- if (bean != null) {
-
- if (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();
- }
- } else {
-
- // row is not valid can not save it
-
- MacroWasteBatch catchBean = bean.toBean();
-
- if (!TuttiEntities.isNew(catchBean)) {
-
- // remove this
- persistenceService.deleteMacroWasteBatch(catchBean.getId());
- }
- }
- }
- }
-
- @Override
- protected boolean isRowValid(MacroWasteBatchRowModel row) {
- boolean result = row.getMacroWasteCategory() != null &&
- row.getWeight() != null;
- return result;
- }
-
- @Override
- protected void saveRow(MacroWasteBatchRowModel row) {
-
- MacroWasteBatch catchBean = row.toBean();
-
- FishingOperation fishingOperation = getModel().getFishingOperation();
- catchBean.setFishingOperation(fishingOperation);
- if (log.isInfoEnabled()) {
- log.info("Selected fishingOperation: " + fishingOperation.getId());
- }
-
- if (TuttiEntities.isNew(catchBean)) {
-
- catchBean = persistenceService.createMacroWasteBatch(catchBean);
- row.setId(catchBean.getId());
- } else {
- persistenceService.saveMacroWasteBatch(catchBean);
- }
- }
-
- @Override
- public void selectFishingOperation(FishingOperation bean) {
-
- JXTable table = getTable();
-
- if (table.isEditing()) {
-
- // make sure to stop editor
- table.editingCanceled(null);
- }
-
- // make sure selection is empty (will remove bean from monitor)
- table.clearSelection();
-
- boolean empty = bean == null;
-
- MacroWasteBatchUIModel model = getModel();
-
- List<MacroWasteBatchRowModel> rows;
-
- if (empty) {
- rows = null;
- } else {
-
- if (log.isInfoEnabled()) {
- log.info("Get species batch for fishingOperation: " +
- bean.getId());
- }
- rows = Lists.newArrayList();
-
- if (!TuttiEntities.isNew(bean)) {
- List<MacroWasteBatch> catches =
- persistenceService.getAllMacroWasteBatch(bean.getId());
- for (MacroWasteBatch aBatch : catches) {
- MacroWasteBatchRowModel entry =
- new MacroWasteBatchRowModel(aBatch);
- rows.add(entry);
- }
- }
- }
-
- model.setRows(rows);
- }
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- public void beforeInitUI() {
-
- if (log.isInfoEnabled()) {
- log.info("beforeInit: " + ui);
- }
-
- EditCatchesUIModel catchesUIModel =
- ui.getContextValue(EditCatchesUIModel.class);
-
- MacroWasteBatchUIModel model = new MacroWasteBatchUIModel(catchesUIModel);
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- if (log.isInfoEnabled()) {
- log.info("afterInit: " + ui);
- }
-
- initUI(ui);
-
- JXTable table = getTable();
-
- // create table column model
- TableColumnModel columnModel = createTableColumnModel();
-
- // create table model
- MacroWasteBatchTableModel tableModel =
- new MacroWasteBatchTableModel(columnModel);
-
- table.setModel(tableModel);
- table.setColumnModel(columnModel);
-
- initBatchTable(table, columnModel, tableModel);
- }
-
- @Override
- public void onCloseUI() {
- if (log.isInfoEnabled()) {
- log.info("closing: " + ui);
- }
- }
-
- //------------------------------------------------------------------------//
- //-- Public methods --//
- //------------------------------------------------------------------------//
-
- //------------------------------------------------------------------------//
- //-- Internal methods --//
- //------------------------------------------------------------------------//
-
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,50 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MacroWasteBatchUIModel extends AbstractTuttiBatchUIModel<MacroWasteBatchRowModel, MacroWasteBatchUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public MacroWasteBatchUIModel(EditCatchesUIModel catchesUIModel) {
- super(catchesUIModel,
- EditCatchesUIModel.PROPERTY_MACRO_WASTE_TOTAL_WEIGHT);
- }
-
- public Float getMacroWasteTotalWeight() {
- return catchesUIModel.getMacroWasteTotalWeight();
- }
-
- public void setMacroWasteTotalWeight(Float macroWasteTotalWeight) {
- catchesUIModel.setMacroWasteTotalWeight(macroWasteTotalWeight);
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchRowModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchRowModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,195 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.plankton;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.Attachment;
-import fr.ifremer.tutti.persistence.entities.data.PlanktonBatch;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * Define a benthos batch row.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class PlanktonBatchRowModel extends AbstractTuttiBeanUIModel<PlanktonBatch, PlanktonBatchRowModel> {
-
- 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_WEIGHT = "weight";
-
- public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
-
- public static final String PROPERTY_SAMPLING_RATIO = "samplingRatio";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_ATTACHMENTS = "attachments";
-
- /**
- * Species observed.
- *
- * @since 0.2
- */
- protected Species species;
-
- /**
- * Is the species need to be confirmed?.
- *
- * @since 0.2
- */
- protected boolean speciesToConfirm;
-
- /**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- /**
- * Sample weight.
- *
- * @since 0.2
- */
- protected Float sampleWeight;
-
- /**
- * Sampling ratio.
- *
- * @since 0.2
- */
- protected Float samplingRatio;
-
- /**
- * Comment on this catches.
- *
- * @since 0.2
- */
- protected String comment;
-
- /**
- * Attachments
- *
- * @since 0.2
- */
- protected List<Attachment> attachments;
-
- protected static final Binder<PlanktonBatch, PlanktonBatchRowModel> fromBeanBinder =
- BinderFactory.newBinder(PlanktonBatch.class,
- PlanktonBatchRowModel.class);
-
- protected static final Binder<PlanktonBatchRowModel, PlanktonBatch> toBeanBinder =
- BinderFactory.newBinder(PlanktonBatchRowModel.class,
- PlanktonBatch.class);
-
- public PlanktonBatchRowModel() {
- super(PlanktonBatch.class, fromBeanBinder, toBeanBinder);
- }
-
- public PlanktonBatchRowModel(PlanktonBatch aBatch) {
- this();
- fromBean(aBatch);
- }
-
- 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 Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- Object oldValue = getWeight();
- this.weight = weight;
- firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
- }
-
- public Float getSampleWeight() {
- return sampleWeight;
- }
-
- public void setSampleWeight(Float sampleWeight) {
- Object oldValue = getSampleWeight();
- this.sampleWeight = sampleWeight;
- firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
- }
-
- public Float getSamplingRatio() {
- return samplingRatio;
- }
-
- public void setSamplingRatio(Float samplingRatio) {
- Object oldValue = getSamplingRatio();
- this.samplingRatio = samplingRatio;
- firePropertyChange(PROPERTY_SAMPLING_RATIO, oldValue, samplingRatio);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public List<Attachment> getAttachments() {
- return attachments;
- }
-
- public void setAttachments(List<Attachment> attachments) {
- Object oldValue = getAttachments();
- this.attachments = attachments;
- firePropertyChange(PROPERTY_ATTACHMENTS, oldValue, attachments);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchTableModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchTableModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,117 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.plankton;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-
-import javax.swing.table.TableColumnModel;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class PlanktonBatchTableModel extends AbstractTuttiTableModel<PlanktonBatchRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final ColumnIdentifier<PlanktonBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
- PlanktonBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
- n_("tutti.table.plankton.batch.header.toConfirm"),
- n_("tutti.table.plankton.batch.header.toConfirm"));
-
- public static final ColumnIdentifier<PlanktonBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
- PlanktonBatchRowModel.PROPERTY_SPECIES,
- n_("tutti.table.plankton.batch.header.speciesByCode"),
- n_("tutti.table.plankton.batch.header.speciesByCode"));
-
- public static final ColumnIdentifier<PlanktonBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
- PlanktonBatchRowModel.PROPERTY_SPECIES,
- n_("tutti.table.plankton.batch.header.speciesByGenusCode"),
- n_("tutti.table.plankton.batch.header.speciesByGenusCode"));
-
- public static final ColumnIdentifier<PlanktonBatchRowModel> WEIGHT = ColumnIdentifier.newId(
- PlanktonBatchRowModel.PROPERTY_WEIGHT,
- n_("tutti.table.plankton.batch.header.weight"),
- n_("tutti.table.plankton.batch.header.weight"));
-
- public static final ColumnIdentifier<PlanktonBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
- PlanktonBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- n_("tutti.table.plankton.batch.header.sampleWeight"),
- n_("tutti.table.plankton.batch.header.sampleWeight"));
-
- public static final ColumnIdentifier<PlanktonBatchRowModel> SAMPLING_RATIO = ColumnIdentifier.newId(
- PlanktonBatchRowModel.PROPERTY_SAMPLING_RATIO,
- n_("tutti.table.plankton.batch.header.elevationRate"),
- n_("tutti.table.plankton.batch.header.elevationRate"));
-
- public static final ColumnIdentifier<PlanktonBatchRowModel> COMMENT = ColumnIdentifier.newId(
- PlanktonBatchRowModel.PROPERTY_COMMENT,
- n_("tutti.table.plankton.batch.header.comment"),
- n_("tutti.table.plankton.batch.header.comment"));
-
- public static final ColumnIdentifier<PlanktonBatchRowModel> ATTACHMENTS = ColumnIdentifier.newId(
- PlanktonBatchRowModel.PROPERTY_ATTACHMENTS,
- n_("tutti.table.plankton.batch.header.file"),
- n_("tutti.table.plankton.batch.header.file"));
-
- public PlanktonBatchTableModel(TableColumnModel columnModel) {
- super(columnModel);
-
- setNoneEditableCols(SAMPLE_WEIGHT, SAMPLING_RATIO);
- }
-
- @Override
- protected PlanktonBatchRowModel createNewRow() {
- PlanktonBatchRowModel result = new PlanktonBatchRowModel();
-
- // by default empty row is not valid
- result.setValid(false);
- return result;
- }
-
- @Override
- public void setValueAt(Object aValue,
- int rowIndex,
- int columnIndex,
- ColumnIdentifier<PlanktonBatchRowModel> propertyName,
- PlanktonBatchRowModel entry) {
- super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
-
- if (propertyName == SPECIES_BY_CODE) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex, SPECIES_BY_GENUS_CODE);
-
- } else if (propertyName == SPECIES_BY_GENUS_CODE) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex, SPECIES_BY_CODE);
- }
- }
-
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,61 +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;
-}
-
-#planktonTotalWeightLabel {
- text: "tutti.label.catches.planktonTotalWeight";
- labelFor: {planktonTotalWeightField};
-}
-
-#planktonTotalWeightField {
- property: "planktonTotalWeight";
- model: {model.getPlanktonTotalWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#planktonTotalSampleWeightLabel {
- text: "tutti.label.catches.planktonTotalSampleWeight";
- labelFor: {planktonTotalSampleWeightField};
-}
-
-#planktonTotalSampleWeightField {
- property: "planktonTotalSampleWeight";
- model: {model.getPlanktonTotalSampleWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#table {
- selectionMode: {ListSelectionModel.SINGLE_SELECTION};
- selectionBackground: {null};
- selectionForeground: {Color.BLACK};
- sortable: false;
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,107 +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<PlanktonBatchUIModel, PlanktonBatchUIHandler>'>
-
- <import>
- fr.ifremer.tutti.ui.swing.TuttiUI
- fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
- fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- org.jdesktop.swingx.JXTable
-
- javax.swing.ListSelectionModel
-
- java.awt.Color
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public PlanktonBatchUI(TuttiUI<?,?> parentUI) {
- JAXXUtil.initContext(this, parentUI);
- PlanktonBatchUIHandler handler = new PlanktonBatchUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <PlanktonBatchUIHandler id='handler'
- initializer='getContextValue(PlanktonBatchUIHandler.class)'/>
-
- <PlanktonBatchUIModel id='model'
- initializer='getContextValue(PlanktonBatchUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='planktonTotalWeight' component='planktonTotalWeightField'/>
- <field name='planktonTotalSampleWeight'
- component='planktonTotalSampleWeightField'/>
- </BeanValidator>
-
- <LongTextEditorUI id='longTextEditor'/>
-
- <AttachmentEditorUI id='attachmentEditor'/>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='planktonTotalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='planktonTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='planktonTotalSampleWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='planktonTotalSampleWeightField'
- constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JXTable id='table'
- onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
- </JScrollPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,397 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.plankton;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.Attachment;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.PlanktonBatch;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.ui.swing.TuttiUI;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
-import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
-import org.nuiton.util.decorator.Decorator;
-
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class PlanktonBatchUIHandler extends AbstractTuttiBatchTableUIHandler<PlanktonBatchRowModel, PlanktonBatchUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(PlanktonBatchUIHandler.class);
-
- /**
- * UI.
- *
- * @since 0.2
- */
- private final PlanktonBatchUI ui;
-
- public PlanktonBatchUIHandler(TuttiUI<?, ?> parentUi, PlanktonBatchUI ui) {
- super(parentUi,
- PlanktonBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
- PlanktonBatchRowModel.PROPERTY_SPECIES,
- PlanktonBatchRowModel.PROPERTY_WEIGHT,
- PlanktonBatchRowModel.PROPERTY_COMMENT);
- this.ui = ui;
- }
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiTableUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- protected PlanktonBatchUIModel getModel() {
- return ui.getModel();
- }
-
- @Override
- protected PlanktonBatchTableModel getTableModel() {
- return (PlanktonBatchTableModel) getTable().getModel();
- }
-
- @Override
- protected JXTable getTable() {
- return ui.getTable();
- }
-
- @Override
- protected FishingOperation getFishingOperation() {
- return getModel().getFishingOperation();
- }
-
- @Override
- protected String[] getRowPropertiesToIgnore() {
- return new String[]{
- PlanktonBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- PlanktonBatchRowModel.PROPERTY_SAMPLING_RATIO
- };
- }
-
- @Override
- protected TableColumnModel createTableColumnModel() {
-
- DefaultTableColumnModelExt columnModel =
- new DefaultTableColumnModelExt();
-
- {
- // Species to confirm column
-
- addBooleanColumnToModel(columnModel,
- PlanktonBatchTableModel.SPECIES_TO_CONFIRM,
- getTable());
- }
-
- List<Species> allSpecies = persistenceService.getAllSpecies();
-
- {
- // Species (by code) column
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_CODE);
-
- addComboDataColumnToModel(columnModel,
- PlanktonBatchTableModel.SPECIES_BY_CODE,
- decorator, allSpecies);
- }
-
- {
- // Species (by genusCode) column
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_GENUS);
-
- addComboDataColumnToModel(columnModel,
- PlanktonBatchTableModel.SPECIES_BY_GENUS_CODE,
- decorator, allSpecies);
-
- }
-
- { // Weight column
-
- addFloatColumnToModel(columnModel,
- PlanktonBatchTableModel.WEIGHT,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Sample weight column
-
- addColumnToModel(columnModel,
- PlanktonBatchTableModel.SAMPLE_WEIGHT);
- }
-
- { // SamplingRatio column
-
- addColumnToModel(columnModel,
- PlanktonBatchTableModel.SAMPLING_RATIO);
- }
-
- { // Comment column
-
- addColumnToModel(columnModel,
- LongTextCellComponent.newEditor(ui.getLongTextEditor()),
- LongTextCellComponent.newRender(n_("tutti.tooltip.comment.none")),
- PlanktonBatchTableModel.COMMENT);
- }
-
- { // File column
-
- addColumnToModel(columnModel,
- AttachmentCellComponent.newEditor(ui.getAttachmentEditor()),
- AttachmentCellComponent.newRender(
- getDecorator(Attachment.class, null),
- n_("tutti.tooltip.attachment.none")),
- PlanktonBatchTableModel.ATTACHMENTS);
- }
- return columnModel;
- }
-
- @Override
- protected void onRowModified(PlanktonBatchRowModel row,
- String propertyName,
- Object oldValue,
- Object newValue) {
-
- boolean wasValid = row.isValid();
-
- boolean valid = isRowValid(row);
-
- if (log.isInfoEnabled()) {
- log.info("Was valid / Is valid: " + wasValid + " / " + valid);
- }
- row.setValid(valid);
- }
-
- @Override
- protected void onRowValidStateChanged(PlanktonBatchRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- int rowIndex = getTableModel().getRowIndex(row);
-
- if (rowIndex > -1) {
- getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
- }
- }
-
- @Override
- protected void onRowModifyStateChanged(PlanktonBatchRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- }
-
- @Override
- protected void onModelRowsChanged(List<PlanktonBatchRowModel> rows) {
- super.onModelRowsChanged(rows);
-
- // set valid flag
- for (PlanktonBatchRowModel row : rows) {
- boolean valid = isRowValid(row);
- row.setValid(valid);
- }
- }
-
- @Override
- protected void saveSelectedRowIfRequired() {
-
- TuttiBeanMonitor<PlanktonBatchRowModel> rowMonitor = getRowMonitor();
-
- PlanktonBatchRowModel bean = rowMonitor.getBean();
- if (bean != null) {
-
- if (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();
- }
- } else {
-
- // row is not valid can not save it
-
- PlanktonBatch catchBean = bean.toBean();
-
- if (!TuttiEntities.isNew(catchBean)) {
-
- // remove this
- persistenceService.deletePlanktonBatch(catchBean.getId());
- }
- }
- }
- }
-
- @Override
- protected boolean isRowValid(PlanktonBatchRowModel row) {
- boolean result = row.getSpecies() != null && row.getWeight() != null;
- return result;
- }
-
- @Override
- protected void saveRow(PlanktonBatchRowModel row) {
-
- PlanktonBatch catchBean = row.toBean();
-
- FishingOperation fishingOperation = getModel().getFishingOperation();
- catchBean.setFishingOperation(fishingOperation);
- if (log.isInfoEnabled()) {
- log.info("Selected fishingOperation: " + fishingOperation.getId());
- }
-
- if (TuttiEntities.isNew(catchBean)) {
-
- catchBean = persistenceService.createPlanktonBatch(catchBean);
- row.setId(catchBean.getId());
- } else {
- persistenceService.savePlanktonBatch(catchBean);
- }
- }
-
- @Override
- public void selectFishingOperation(FishingOperation bean) {
-
- JXTable table = getTable();
-
- if (table.isEditing()) {
-
- // make sure to stop editor
- table.editingCanceled(null);
- }
-
- // make sure selection is empty (will remove bean from monitor)
- table.clearSelection();
-
- boolean empty = bean == null;
-
- PlanktonBatchUIModel model = getModel();
-
- List<PlanktonBatchRowModel> rows;
-
- if (empty) {
- rows = null;
- } else {
-
-
- if (log.isInfoEnabled()) {
- log.info("Get species batch for fishingOperation: " +
- bean.getId());
- }
- rows = Lists.newArrayList();
-
- if (!TuttiEntities.isNew(bean)) {
- List<PlanktonBatch> catches =
- persistenceService.getAllPlanktonBatch(bean.getId());
- for (PlanktonBatch aBatch : catches) {
- PlanktonBatchRowModel entry =
- new PlanktonBatchRowModel(aBatch);
- rows.add(entry);
- }
- }
- }
-
- model.setRows(rows);
- }
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- public void beforeInitUI() {
-
- if (log.isInfoEnabled()) {
- log.info("beforeInit: " + ui);
- }
-
- EditCatchesUIModel catchesUIModel =
- ui.getContextValue(EditCatchesUIModel.class);
-
- PlanktonBatchUIModel model = new PlanktonBatchUIModel(catchesUIModel);
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- if (log.isInfoEnabled()) {
- log.info("afterInit: " + ui);
- }
-
- initUI(ui);
-
- JXTable table = getTable();
-
- // create table column model
- TableColumnModel columnModel = createTableColumnModel();
-
- // create table model
- PlanktonBatchTableModel tableModel =
- new PlanktonBatchTableModel(columnModel);
-
- table.setModel(tableModel);
- table.setColumnModel(columnModel);
-
- initBatchTable(table, columnModel, tableModel);
- }
-
- @Override
- public void onCloseUI() {
- if (log.isInfoEnabled()) {
- log.info("closing: " + ui);
- }
- }
-
- //------------------------------------------------------------------------//
- //-- Public methods --//
- //------------------------------------------------------------------------//
-
- //------------------------------------------------------------------------//
- //-- Internal methods --//
- //------------------------------------------------------------------------//
-
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,59 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.plankton;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class PlanktonBatchUIModel extends AbstractTuttiBatchUIModel<PlanktonBatchRowModel, PlanktonBatchUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public PlanktonBatchUIModel(EditCatchesUIModel catchesUIModel) {
- super(catchesUIModel,
- EditCatchesUIModel.PROPERTY_PLANKTON_TOTAL_WEIGHT,
- EditCatchesUIModel.PROPERTY_PLANKTON_TOTAL_SAMPLE_WEIGHT);
- }
-
- public Float getPlanktonTotalWeight() {
- return catchesUIModel.getPlanktonTotalWeight();
- }
-
- public void setPlanktonTotalWeight(Float planktonTotalWeight) {
- catchesUIModel.setPlanktonTotalWeight(planktonTotalWeight);
- }
-
- public Float getPlanktonTotalSampleWeight() {
- return catchesUIModel.getPlanktonTotalSampleWeight();
- }
-
- public void setPlanktonTotalSampleWeight(Float planktonTotalSampleWeight) {
- catchesUIModel.setPlanktonTotalSampleWeight(planktonTotalSampleWeight);
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,257 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JButton;
-import javax.swing.JTable;
-import javax.swing.border.LineBorder;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Frame;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Component to render and edit frequency stuff from batch table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class FrequencyCellComponent extends JButton {
-
- private static final long serialVersionUID = 1L;
-
- public static final String ROW_INDEX = "rowIndex";
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(FrequencyCellComponent.class);
-
- public FrequencyCellComponent() {
- setContentAreaFilled(false);
- setOpaque(false);
- setIcon(SwingUtil.createActionIcon("show-frequency"));
- }
-
- public static TableCellRenderer newRender() {
- return new FrequencyCellRenderer();
- }
-
- public static TableCellEditor newEditor(SpeciesFrequencyUI ui) {
- return new FrequencyCellEditor(ui);
- }
-
- public static class FrequencyCellEditor extends AbstractCellEditor implements TableCellEditor {
-
- private static final long serialVersionUID = 1L;
-
- protected final FrequencyCellComponent component;
-
- protected final SpeciesFrequencyUI ui;
-
- protected Frame frame;
-
- protected JTable table;
-
- protected SpeciesBatchTableModel tableModel;
-
- protected ColumnIdentifier<SpeciesBatchRowModel> columnIdentifier;
-
- protected SpeciesBatchRowModel editRow;
-
- protected Integer rowIndex;
-
- protected Integer columnIndex;
-
- public FrequencyCellEditor(SpeciesFrequencyUI ui) {
- this.ui = ui;
- component = new FrequencyCellComponent();
- component.setBorder(new LineBorder(Color.BLACK));
- component.addKeyListener(new KeyAdapter() {
- @Override
- public void keyReleased(KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER ||
- e.getKeyCode() == KeyEvent.VK_SPACE) {
- e.consume();
- startEdit();
- }
- }
- });
-
- component.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- e.consume();
- startEdit();
- }
- });
- }
-
- protected void startEdit() {
-
- Preconditions.checkNotNull(tableModel, "No table model assigned.");
-
- // open frequency dialog
-
- Preconditions.checkNotNull(editRow, "No editRow found.");
-
- if (log.isInfoEnabled()) {
- log.info("Will edit frequencies for row: " + rowIndex);
- }
-
- if (frame == null) {
- frame = SwingUtil.getParentContainer(ui, Frame.class);
- }
-
- ui.editBatch(editRow);
-
- // open frequency dialog
- TuttiUIUtil.openInDialog(
- ui, frame, _("tutti.title.frequency"), true, null);
-
- // at close, synch back frequencies
-
- editRow.updateTotalFromFrequencies();
-
- int r = rowIndex;
- int c = columnIndex;
-
- // stop edition
- stopCellEditing();
-
- // reselect this cell
- AbstractSelectTableAction.doSelectCell(table, r, c);
- table.requestFocus();
- }
-
- @Override
- public Component getTableCellEditorComponent(JTable table,
- Object value,
- boolean isSelected,
- int row,
- int column) {
- if (tableModel == null) {
- tableModel = (SpeciesBatchTableModel) table.getModel();
- this.table = table;
- columnIdentifier = tableModel.getPropertyName(column);
- }
- String text;
- if (value == null) {
- text = " - ";
- } else {
- text = String.valueOf(value);
- }
- component.setText(text);
-
- rowIndex = row;
- columnIndex = column;
-
- editRow = tableModel.getEntry(row);
-
- return component;
- }
-
- @Override
- public Object getCellEditorValue() {
-
- Preconditions.checkNotNull(editRow, "No editRow found in editor.");
-
- Object result;
- if (columnIdentifier == SpeciesBatchTableModel.COMPUTED_NUMBER) {
- result = editRow.getComputedNumber();
- } else {
- result = editRow.getComputedWeight();
- }
- if (log.isInfoEnabled()) {
- log.info("editor value (" + columnIdentifier + "): " + result);
- }
-
- return result;
- }
-
- @Override
- public boolean stopCellEditing() {
- boolean b = super.stopCellEditing();
- if (b) {
- rowIndex = null;
- editRow = null;
- columnIndex = null;
- }
- return b;
- }
-
- @Override
- public void cancelCellEditing() {
- super.cancelCellEditing();
- rowIndex = null;
- columnIndex = null;
- editRow = null;
- }
- }
-
- public static class FrequencyCellRenderer implements TableCellRenderer {
-
- protected final FrequencyCellComponent component;
-
- public FrequencyCellRenderer() {
- component = new FrequencyCellComponent();
- }
-
- @Override
- public Component getTableCellRendererComponent(JTable table,
- Object value,
- boolean isSelected,
- boolean hasFocus,
- int row,
- int column) {
-
- String text;
- if (value == null) {
- text = " - ";
- } else {
- text = String.valueOf(value);
- }
- boolean editable = table.isCellEditable(row, column);
- component.setEnabled(editable);
- component.setText(text);
- return component;
- }
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,390 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.data.Attachment;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.apache.commons.collections.CollectionUtils;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Represents a species batch (i.e a row in the batch table).
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class SpeciesBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, SpeciesBatchRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_SPECIES = "species";
-
- public static final String PROPERTY_SPECIES_TO_CONFIRM = "speciesToConfirm";
-
- public static final String PROPERTY_SORTED_UNSORTED_CATEGORY = "sortedUnsortedCategory";
-
- public static final String PROPERTY_SIZE_CATEGORY = "sizeCategory";
-
- public static final String PROPERTY_SEX_CATEGORY = "sexCategory";
-
- public static final String PROPERTY_MATURITY_CATEGORY = "maturityCategory";
-
- public static final String PROPERTY_AGE = "age";
-
- public static final String PROPERTY_WEIGHT = "weight";
-
- public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
-
- public static final String PROPERTY_SAMPLING_RATIO = "samplingRatio";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_FREQUENCY = "frequency";
-
- public static final String PROPERTY_COMPUTED_NUMBER = "computedNumber";
-
- public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight";
-
- public static final String PROPERTY_ATTACHMENTS = "attachments";
-
- /**
- * 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 CaracteristicQualitativeValue sortedUnsortedCategory;
-
- /**
- * Weight category (can be null).
- *
- * @since 0.2
- */
- protected CaracteristicQualitativeValue sizeCategory;
-
- /**
- * Sex (can be null).
- *
- * @since 0.2
- */
- protected CaracteristicQualitativeValue sexCategory;
-
- /**
- * Maturity (can be null).
- *
- * @since 0.2
- */
- protected CaracteristicQualitativeValue maturityCategory;
-
- /**
- * 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;
-
- /**
- * Sampling ratio.
- *
- * @since 0.2
- */
- protected Float samplingRatio;
-
- /**
- * Comment on this catches.
- *
- * @since 0.2
- */
- protected String comment;
-
- /**
- * Attachments
- *
- * @since 0.2
- */
- protected List<Attachment> attachments;
-
- /**
- * List of frequencies observed for this batch.
- *
- * @since 0.2
- */
- protected List<SpeciesFrequencyRowModel> frequency;
-
- protected static final Binder<SpeciesBatch, SpeciesBatchRowModel> fromBeanBinder =
- BinderFactory.newBinder(SpeciesBatch.class,
- SpeciesBatchRowModel.class);
-
- protected static final Binder<SpeciesBatchRowModel, SpeciesBatch> toBeanBinder =
- BinderFactory.newBinder(SpeciesBatchRowModel.class,
- SpeciesBatch.class);
-
- public SpeciesBatchRowModel() {
- super(SpeciesBatch.class, fromBeanBinder, toBeanBinder);
- frequency = Lists.newArrayList();
- }
-
- public SpeciesBatchRowModel(SpeciesBatch aBatch,
- List<SpeciesBatchFrequency> frequencies) {
- this();
- fromBean(aBatch);
- List<SpeciesFrequencyRowModel> frequencyRows =
- SpeciesFrequencyRowModel.fromBeans(frequencies);
- frequency.addAll(frequencyRows);
- Collections.sort(frequency);
- updateTotalFromFrequencies();
- }
-
- public void updateTotalFromFrequencies() {
- Float totalNumber = null;
- Float totalWeight = null;
- if (CollectionUtils.isNotEmpty(frequency)) {
- totalNumber = 0f;
- totalWeight = 0f;
- for (SpeciesFrequencyRowModel frequencyModel : frequency) {
- totalNumber += frequencyModel.getNumber();
- Float w = frequencyModel.getWeight();
- if (w == null) {
-
- // can't sum when a null value appears
- totalWeight = null;
- } else if (totalWeight != null) {
-
- // still can sum weights
- totalWeight += w;
- }
- }
- }
-
- setComputedNumber(totalNumber);
- setComputedWeight(totalWeight);
- }
-
- public Species getSpecies() {
- return species;
- }
-
- public void setSpecies(Species species) {
- Object oldValue = getSpecies();
- this.species = species;
- firePropertyChange(PROPERTY_SPECIES, oldValue, species);
- }
-
- public Boolean getSpeciesToConfirm() {
- return speciesToConfirm;
- }
-
- public void setSpeciesToConfirm(Boolean speciesToConfirm) {
- Object oldValue = getSpeciesToConfirm();
- this.speciesToConfirm = speciesToConfirm;
- firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
- }
-
- public CaracteristicQualitativeValue getSortedUnsortedCategory() {
- return sortedUnsortedCategory;
- }
-
- public void setSortedUnsortedCategory(CaracteristicQualitativeValue sortedUnsortedCategory) {
- Object oldValue = getSortedUnsortedCategory();
- this.sortedUnsortedCategory = sortedUnsortedCategory;
- firePropertyChange(PROPERTY_SORTED_UNSORTED_CATEGORY, oldValue, sortedUnsortedCategory);
- }
-
- public CaracteristicQualitativeValue getSizeCategory() {
- return sizeCategory;
- }
-
- public void setSizeCategory(CaracteristicQualitativeValue sizeCategory) {
- Object oldValue = getSizeCategory();
- this.sizeCategory = sizeCategory;
- firePropertyChange(PROPERTY_SIZE_CATEGORY, oldValue, sizeCategory);
- }
-
- public CaracteristicQualitativeValue getSexCategory() {
- return sexCategory;
- }
-
- public void setSexCategory(CaracteristicQualitativeValue sexCategory) {
- Object oldValue = getSexCategory();
- this.sexCategory = sexCategory;
- firePropertyChange(PROPERTY_SEX_CATEGORY, oldValue, sexCategory);
- }
-
- public CaracteristicQualitativeValue getMaturityCategory() {
- return maturityCategory;
- }
-
- public void setMaturityCategory(CaracteristicQualitativeValue maturityCategory) {
- Object oldValue = getMaturityCategory();
- this.maturityCategory = maturityCategory;
- firePropertyChange(PROPERTY_MATURITY_CATEGORY, oldValue, maturityCategory);
- }
-
- public Float getAge() {
- return age;
- }
-
- public void setAge(Float age) {
- Object oldValue = getAge();
- this.age = age;
- firePropertyChange(PROPERTY_AGE, oldValue, age);
- }
-
- public Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- Object oldValue = getWeight();
- this.weight = weight;
- firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
- }
-
- public Float getSampleWeight() {
- return sampleWeight;
- }
-
- public void setSampleWeight(Float sampleWeight) {
- Object oldValue = getSampleWeight();
- this.sampleWeight = sampleWeight;
- firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
- }
-
- public Float getSamplingRatio() {
- return samplingRatio;
- }
-
- public void setSamplingRatio(Float samplingRatio) {
- Object oldValue = getSamplingRatio();
- this.samplingRatio = samplingRatio;
- firePropertyChange(PROPERTY_SAMPLING_RATIO, oldValue, samplingRatio);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public List<Attachment> getAttachments() {
- return attachments;
- }
-
- public void setAttachments(List<Attachment> attachments) {
- Object oldValue = getAttachments();
- this.attachments = attachments;
- firePropertyChange(PROPERTY_ATTACHMENTS, oldValue, attachments);
- }
-
- 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);
- }
-
- public int getRowCount() {
- return frequency == null ? 0 : frequency.size();
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,202 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-
-import javax.swing.table.TableColumnModel;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesBatchTableModel extends AbstractTuttiTableModel<SpeciesBatchRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- n_("tutti.table.species.batch.header.speciesByCode"),
- n_("tutti.table.species.batch.header.speciesByCode"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- n_("tutti.table.species.batch.header.speciesByGenusCode"),
- n_("tutti.table.species.batch.header.speciesByGenusCode"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SORTED_UNSORTED_CATEGORY = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
- n_("tutti.table.species.batch.header.sortedUnsortedCategory"),
- n_("tutti.table.species.batch.header.sortedUnsortedCategory"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SIZE_CATEGORY = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SIZE_CATEGORY,
- n_("tutti.table.species.batch.header.sizeCategory"),
- n_("tutti.table.species.batch.header.sizeCategory"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SEX_CATEGORY = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SEX_CATEGORY,
- n_("tutti.table.species.batch.header.sexCategory"),
- n_("tutti.table.species.batch.header.sexCategory"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> MATURITY_CATEGORY = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_MATURITY_CATEGORY,
- n_("tutti.table.species.batch.header.maturityCategory"),
- n_("tutti.table.species.batch.header.maturityCategory"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> AGE = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_AGE,
- n_("tutti.table.species.batch.header.age"),
- n_("tutti.table.species.batch.header.age"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> WEIGHT = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_WEIGHT,
- n_("tutti.table.species.batch.header.weight"),
- n_("tutti.table.species.batch.header.weight"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_COMPUTED_WEIGHT,
- n_("tutti.table.species.batch.header.computedWeight"),
- n_("tutti.table.species.batch.header.computedWeight"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_NUMBER = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_COMPUTED_NUMBER,
- n_("tutti.table.species.batch.header.computedNumber"),
- n_("tutti.table.species.batch.header.computedNumber"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- n_("tutti.table.species.batch.header.sampleWeight"),
- n_("tutti.table.species.batch.header.sampleWeight"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SAMPLING_RATIO = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
- n_("tutti.table.species.batch.header.elevationRate"),
- n_("tutti.table.species.batch.header.elevationRate"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> COMMENT = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_COMMENT,
- n_("tutti.table.species.batch.header.comment"),
- n_("tutti.table.species.batch.header.comment"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> ATTACHMENTS = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_ATTACHMENTS,
- n_("tutti.table.species.batch.header.file"),
- n_("tutti.table.species.batch.header.file"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
- n_("tutti.table.species.batch.header.toConfirm"),
- n_("tutti.table.species.batch.header.toConfirm"));
-
- protected final Set<ColumnIdentifier<SpeciesBatchRowModel>> noneEditableColIfNoSpecies;
-
- public SpeciesBatchTableModel(TableColumnModel columnModel) {
- super(columnModel);
-
- setNoneEditableCols(SAMPLE_WEIGHT, SAMPLING_RATIO);
- noneEditableColIfNoSpecies = Sets.newHashSet();
- noneEditableColIfNoSpecies.add(COMPUTED_NUMBER);
- noneEditableColIfNoSpecies.add(COMPUTED_WEIGHT);
- }
-
- @Override
- protected SpeciesBatchRowModel createNewRow() {
- SpeciesBatchRowModel result = new SpeciesBatchRowModel();
-
- // by default empty row is not valid
- result.setValid(false);
- return result;
- }
-
- @Override
- public void setValueAt(Object aValue,
- int rowIndex,
- int columnIndex,
- ColumnIdentifier<SpeciesBatchRowModel> propertyName,
- SpeciesBatchRowModel entry) {
- super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
-
- if (propertyName == SPECIES_BY_CODE) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex,
- SPECIES_BY_GENUS_CODE,
- COMPUTED_NUMBER,
- COMPUTED_WEIGHT);
-
- } else if (propertyName == SPECIES_BY_GENUS_CODE) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex,
- SPECIES_BY_CODE,
- COMPUTED_NUMBER,
- COMPUTED_WEIGHT);
- } else if (propertyName == COMPUTED_NUMBER) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex, COMPUTED_WEIGHT);
-
- } else if (propertyName == COMPUTED_WEIGHT) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex, COMPUTED_NUMBER);
- }
- }
-
- public void updateSamplingRatio(Set<SpeciesBatchRowModel> rows) {
- for (SpeciesBatchRowModel row : rows) {
- int rowIndex = getRows().indexOf(row);
- fireTableCellUpdated(rowIndex, SAMPLE_WEIGHT, SAMPLING_RATIO);
- }
-
-
- }
-
- @Override
- protected boolean isCellEditable(int rowIndex,
- int columnIndex,
- ColumnIdentifier<SpeciesBatchRowModel> propertyName) {
-
- boolean result = super.isCellEditable(rowIndex,
- columnIndex,
- propertyName);
- if (result) {
-
- if (noneEditableColIfNoSpecies.contains(propertyName)) {
-
- // must have filled a species to edit this column
- SpeciesBatchRowModel entry = getEntry(rowIndex);
- result = entry.getSpecies() != null;
- }
- }
- return result;
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,297 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import org.apache.commons.collections.CollectionUtils;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @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 String[] samplingOrder;
-
- /**
- * Mapping from row to node.
- *
- * @since 0.2
- */
- protected final Map<SpeciesBatchRowModel, SpeciesBatchTreeNode> rowToNode;
-
- /**
- * Mapping from node to row.
- *
- * @since 0.2
- */
- protected final Multimap<SpeciesBatchTreeNode, SpeciesBatchRowModel> nodeToRow;
-
- public SpeciesBatchTreeModel(String... samplingOrder) {
- this.samplingOrder = samplingOrder;
- root = new SpeciesBatchTreeNode();
- rowToNode = Maps.newHashMap();
- nodeToRow = HashMultimap.create();
- }
-
- public void populate(List<SpeciesBatchRowModel> rows) {
-
- clear();
-
- for (SpeciesBatchRowModel row : rows) {
-
- SpeciesBatchTreeNode node = getSamplingNode(row);
-
- // check if row is valid
- boolean rowIsValid = isValid(row, node);
-
- // set it in row
- row.setValid(rowIsValid);
- }
- }
-
- public String[] getSamplingOrder() {
- return samplingOrder;
- }
-
- public void setSamplingOrder(String... samplingOrder) {
- this.samplingOrder = samplingOrder;
- clear();
- }
-
- protected void clear() {
- // clear tree representation
- root.removeAllChildren();
-
- // clear mappings
- rowToNode.clear();
- nodeToRow.clear();
- }
-
- public SpeciesBatchTreeNode removeNodeFromCache(SpeciesBatchRowModel row) {
- SpeciesBatchTreeNode result = rowToNode.remove(row);
- if (result != null) {
-
- nodeToRow.remove(result, row);
- }
- return result;
- }
-
- public SpeciesBatchTreeNode getSamplingNode(SpeciesBatchRowModel row) {
-
- // search frist in cache
- SpeciesBatchTreeNode result = rowToNode.get(row);
-
- if (result == null) {
-
- // not in cache must build the path
- result = getSamplingNode(root, 0, row);
-
- if (result == root) {
-
- // this means an empty row, so no node for it
- result = null;
-
- } else {
-
- // found a row with a sampling, add it in cache
- rowToNode.put(row, result);
- nodeToRow.put(result, row);
- }
- }
- return result;
- }
-
- protected SpeciesBatchTreeNode getSamplingNode(SpeciesBatchTreeNode node,
- int samplingIndex,
- SpeciesBatchRowModel row) {
-
- String samplingKey = samplingOrder[samplingIndex];
-
- Serializable samplingValue = (Serializable)
- TuttiUIUtil.getProperty(row, samplingKey);
-
- SpeciesBatchTreeNode result;
-
- if (samplingValue == null) {
-
- // was already on last sampling node
- result = node;
- } else {
-
- result = node.getChild(samplingValue);
-
- if (result == null) {
-
- // new node, creates it and add it as child of current node
- result = new SpeciesBatchTreeNode(samplingKey, samplingValue);
- node.add(result);
- }
-
- if (samplingIndex < samplingOrder.length) {
-
- // can try to find yet another sampling level
- result = getSamplingNode(result, samplingIndex + 1, row);
- }
- }
-
- return result;
- }
-
- public SamplingContext createSamplingContext(SpeciesBatchTreeNode rootNode) {
-
- Set<SpeciesBatchRowModel> childRows = Sets.newHashSet();
-
- SpeciesBatchRowModel superSamplingRow = getNodeToRow(rootNode);
-
- float totalWeight = 0f;
- for (int i = 0, nbChildren = rootNode.getChildCount(); i < nbChildren; i++) {
- SpeciesBatchTreeNode node = rootNode.getChildAt(i);
-
- SpeciesBatchRowModel row = getNodeToRow(node);
- if (row != null) {
- CaracteristicQualitativeValue sortedUnsortedCategory =
- row.getSortedUnsortedCategory();
- if (sortedUnsortedCategory != null &&
- "unsorted".equals(sortedUnsortedCategory.getName())) {
-
- // never take account of a such child
-
- } else {
-
- childRows.add(row);
- Float weight = row.getWeight();
- if (weight != null) {
- totalWeight += weight;
- }
- }
- }
- }
- SamplingContext result = new SamplingContext(rootNode,
- superSamplingRow,
- childRows,
- totalWeight);
- return result;
- }
-
- public SpeciesBatchRowModel getNodeToRow(SpeciesBatchTreeNode node) {
- Collection<SpeciesBatchRowModel> rows = nodeToRow.get(node);
-
- SpeciesBatchRowModel result = null;
- if (CollectionUtils.isNotEmpty(rows)) {
- for (SpeciesBatchRowModel next : rows) {
- if (next.isValid()) {
- result = next;
- break;
- }
- }
- }
- return result;
- }
-
- public boolean isValid(SpeciesBatchRowModel row, SpeciesBatchTreeNode newNode) {
-
- // row must be on a sampling and having a weight
- boolean result = row.getWeight() != null && newNode != null;
-
- // make sure there is not already another row for this node
- if (result && CollectionUtils.size(nodeToRow.get(newNode)) > 1) {
- result = false;
- }
-
- return result;
- }
-
- public static class SamplingContext {
-
- private final SpeciesBatchTreeNode rootNode;
-
- private final SpeciesBatchRowModel superSamplingRow;
-
- private final Set<SpeciesBatchRowModel> samplingRows;
-
- private final float totalWeight;
-
- public SamplingContext(SpeciesBatchTreeNode rootNode,
- SpeciesBatchRowModel superSamplingRow,
- Set<SpeciesBatchRowModel> samplingRows,
- float totalWeight) {
- this.rootNode = rootNode;
- this.superSamplingRow = superSamplingRow;
- this.samplingRows = samplingRows;
- this.totalWeight = totalWeight;
- }
-
- public SpeciesBatchTreeNode getRootNode() {
- return rootNode;
- }
-
- public SpeciesBatchRowModel getSuperSamplingRow() {
- return superSamplingRow;
- }
-
- public Set<SpeciesBatchRowModel> getSamplingRows() {
- return samplingRows;
- }
-
- public float getTotalWeight() {
- return totalWeight;
- }
-
- public void applyNewSampleValues(float samplingWeight,
- Float samplingRatio) {
-
- for (SpeciesBatchRowModel row : samplingRows) {
- row.setSampleWeight(samplingWeight);
- row.setSamplingRatio(samplingRatio);
- }
- }
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,175 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import org.apache.commons.lang3.ObjectUtils;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreeNode;
-import java.io.Serializable;
-import java.util.Arrays;
-
-/**
- * Defines a node of a species catches sampling.
- * <p/>
- * A path in the tree gives a sampling path.
- * <p/>
- * UserObject is the {@code samplingValue}. It can be null only on root node.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-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 samplingKey;
-
- public SpeciesBatchTreeNode() {
- this(null, null);
- }
-
- public SpeciesBatchTreeNode(String samplingKey,
- Serializable samplingValue) {
- this.samplingKey = samplingKey;
- setUserObject(samplingValue);
- }
-
- public String getSamplingPropertyKey() {
- return samplingKey;
- }
-
- public boolean matchSamplingValue(Serializable value) {
- Serializable samplingValue = getUserObject();
-
- boolean result = ObjectUtils.equals(value, samplingValue);
- return result;
- }
-
- public SpeciesBatchTreeNode getChild(Serializable samplingValue) {
- SpeciesBatchTreeNode result = null;
-
- for (int i = 0, max = getChildCount(); i < max; i++) {
- SpeciesBatchTreeNode child = getChildAt(i);
- if (child.matchSamplingValue(samplingValue)) {
-
- // found matching child
- result = child;
- break;
- }
- }
- return result;
- }
-
- @Override
- public Serializable getUserObject() {
- return (Serializable) super.getUserObject();
- }
-
- @Override
- public SpeciesBatchTreeNode getChildAt(int index) {
- return (SpeciesBatchTreeNode) super.getChildAt(index);
- }
-
- @Override
- public SpeciesBatchTreeNode getParent() {
- return (SpeciesBatchTreeNode) super.getParent();
- }
-
- @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();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof SpeciesBatchTreeNode)) return false;
-
- SpeciesBatchTreeNode that = (SpeciesBatchTreeNode) o;
-
- Object[] path = getUserObjectPath();
- Object[] path2 = that.getUserObjectPath();
- return Arrays.equals(path, path2);
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css 2012-12-21 20:51:46 UTC (rev 105)
@@ -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;
-}
-
-#speciesTotalWeightLabel {
- text: "tutti.label.catches.speciesTotalWeight";
- labelFor: {speciesTotalWeightField};
-}
-
-#speciesTotalWeightField {
- property: "speciesTotalWeight";
- model: {model.getSpeciesTotalWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#speciesTotalSortedWeightLabel {
- text: "tutti.label.catches.speciesTotalSortedWeight";
- labelFor: {speciesTotalSortedWeightField};
-}
-
-#speciesTotalSortedWeightField {
- property: "speciesTotalSortedWeight";
- model: {model.getSpeciesTotalSortedWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#speciesTotalSampleSortedWeightLabel {
- text: "tutti.label.catches.speciesTotalSampleSortedWeight";
- labelFor: {speciesTotalSampleSortedWeightField};
-}
-
-#speciesTotalSampleSortedWeightField {
- property: "speciesTotalSampleSortedWeight";
- model: {model.getSpeciesTotalSampleSortedWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#speciesTotalUnsortedWeightLabel {
- text: "tutti.label.catches.speciesTotalUnsortedWeight";
- labelFor: {speciesTotalUnsortedWeightField};
-}
-
-#speciesTotalUnsortedWeightField {
- text: {getStringValue(model.getSpeciesTotalUnsortedWeight())};
- editable: false;
-}
-
-#table {
- selectionMode: {ListSelectionModel.SINGLE_SELECTION};
- selectionBackground: {null};
- selectionForeground: {Color.BLACK};
- sortable: false;
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,127 +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<SpeciesBatchUIModel, SpeciesBatchUIHandler>'>
-
- <import>
- fr.ifremer.tutti.ui.swing.TuttiUI
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
- fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
-
- org.jdesktop.swingx.JXTable
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.ListSelectionModel
-
- java.awt.Color
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
- </import>
-
- <script><![CDATA[
-
-public SpeciesBatchUI(TuttiUI<?,?> parentUI) {
- JAXXUtil.initContext(this, parentUI);
- SpeciesBatchUIHandler handler = new SpeciesBatchUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <SpeciesBatchUIHandler id='handler'
- initializer='getContextValue(SpeciesBatchUIHandler.class)'/>
-
- <SpeciesBatchUIModel id='model'
- initializer='getContextValue(SpeciesBatchUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='speciesTotalWeight' component='speciesTotalWeightField'/>
- <field name='speciesTotalSortedWeight'
- component='speciesTotalSortedWeightField'/>
- <field name='speciesTotalSampleSortedWeight'
- component='speciesTotalSampleSortedWeightField'/>
- <field name='speciesTotalUnsortedWeight'
- component='speciesTotalUnsortedWeightField'/>
- </BeanValidator>
-
- <SpeciesFrequencyUI id='frequencyEditor'
- constructorParams='handler.getContext()'/>
-
- <LongTextEditorUI id='longTextEditor'/>
-
- <AttachmentEditorUI id='attachmentEditor'/>
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total / Poids total vrac -->
- <row>
- <cell anchor='west'>
- <JLabel id='speciesTotalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='speciesTotalWeightField' constructorParams='this'/>
- </cell>
- <cell anchor='west'>
- <JLabel id='speciesTotalSortedWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='speciesTotalSortedWeightField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids échantillonné vrac / Poids total hors vrac -->
- <row>
- <cell>
- <JLabel id='speciesTotalSampleSortedWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='speciesTotalSampleSortedWeightField'
- constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='speciesTotalUnsortedWeightLabel'/>
- </cell>
- <cell>
- <JTextField id='speciesTotalUnsortedWeightField'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event)'/>
- </JScrollPane>
-
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,683 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.Attachment;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
-import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.ui.swing.TuttiUI;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
-import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
-import org.nuiton.util.decorator.Decorator;
-
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesBatchUIHandler extends AbstractTuttiBatchTableUIHandler<SpeciesBatchRowModel, SpeciesBatchUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(SpeciesBatchUIHandler.class);
-
- public static final Set<String> RECOMPUTE_TOTAL_WEIGHT = Sets.newHashSet(
- SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_WEIGHT);
-
- public static final Set<String> SAMPLING_PROPERTIES = Sets.newHashSet(
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SIZE_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SEX_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_MATURITY_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_AGE);
-
- /**
- * UI.
- *
- * @since 0.2
- */
- private final SpeciesBatchUI ui;
-
- public SpeciesBatchUIHandler(TuttiUI<?, ?> parentUi,
- SpeciesBatchUI ui) {
- super(parentUi,
- SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SIZE_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SEX_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_MATURITY_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_AGE,
- SpeciesBatchRowModel.PROPERTY_WEIGHT,
- SpeciesBatchRowModel.PROPERTY_COMMENT,
- SpeciesBatchRowModel.PROPERTY_ATTACHMENTS,
- SpeciesBatchRowModel.PROPERTY_FREQUENCY);
- this.ui = ui;
- }
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiTableUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- protected SpeciesBatchUIModel getModel() {
- return ui.getModel();
- }
-
- @Override
- protected SpeciesBatchTableModel getTableModel() {
- return (SpeciesBatchTableModel) getTable().getModel();
- }
-
- @Override
- protected JXTable getTable() {
- return ui.getTable();
- }
-
- @Override
- protected FishingOperation getFishingOperation() {
- return getModel().getFishingOperation();
- }
-
- @Override
- protected void onModelRowsChanged(List<SpeciesBatchRowModel> rows) {
- super.onModelRowsChanged(rows);
-
- // build the new sampling tree from the new rows to edit
- getModel().getSamplingTreeModel().populate(rows);
- }
-
- @Override
- protected String[] getRowPropertiesToIgnore() {
- return new String[]{
- SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
- SpeciesBatchRowModel.PROPERTY_FREQUENCY};
- }
-
- @Override
- protected TableColumnModel createTableColumnModel() {
-
- DefaultTableColumnModelExt columnModel =
- new DefaultTableColumnModelExt();
-
- Decorator<CaracteristicQualitativeValue> caracteristicDecorator =
- getDecorator(CaracteristicQualitativeValue.class, null);
-
- List<Species> allSpecies = persistenceService.getAllSpecies();
-
- {
- // Species (by code) column
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_CODE);
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_BY_CODE,
- decorator, allSpecies);
- }
-
- {
- // Species (by genusCode) column
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_GENUS);
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
- decorator, allSpecies);
-
- }
-
- {
-
- // SortedUnsortedCategory column
-
- Caracteristic data =
- persistenceService.getSortedUnsortedCaracteristic();
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SORTED_UNSORTED_CATEGORY,
- caracteristicDecorator,
- data.getQualitativeValue());
- }
-
- {
-
- // SizeCategory column
-
- Caracteristic data =
- persistenceService.getSizeCategoryCaracteristic();
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SIZE_CATEGORY,
- caracteristicDecorator,
- data.getQualitativeValue());
- }
-
- {
-
- // SexCategory column
-
- Caracteristic data = persistenceService.getSexCaracteristic();
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SEX_CATEGORY,
- caracteristicDecorator,
- data.getQualitativeValue());
- }
-
- {
-
- // MaturityCategory column
-
- Caracteristic data =
- persistenceService.getMaturityCaracteristic();
-
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.MATURITY_CATEGORY,
- caracteristicDecorator,
- data.getQualitativeValue());
- }
-
- {
-
- // Age column
-
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.AGE,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Weight column
-
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.WEIGHT,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Computed weight column (from frequencies)
-
- addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(ui.getFrequencyEditor()),
- FrequencyCellComponent.newRender(),
- SpeciesBatchTableModel.COMPUTED_WEIGHT);
- }
-
- { // Computed number column (from frequencies)
-
- addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(ui.getFrequencyEditor()),
- FrequencyCellComponent.newRender(),
- SpeciesBatchTableModel.COMPUTED_NUMBER);
- }
-
- { // Sample weight column
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.SAMPLE_WEIGHT);
- }
-
- { // SamplingRatio column
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.SAMPLING_RATIO);
- }
-
- { // Comment column
-
- addColumnToModel(columnModel,
- LongTextCellComponent.newEditor(ui.getLongTextEditor()),
- LongTextCellComponent.newRender(n_("tutti.tooltip.comment.none")),
- SpeciesBatchTableModel.COMMENT);
- }
-
- { // File column
-
- addColumnToModel(columnModel,
- AttachmentCellComponent.newEditor(ui.getAttachmentEditor()),
- AttachmentCellComponent.newRender(
- getDecorator(Attachment.class, null),
- n_("tutti.tooltip.attachment.none")),
- SpeciesBatchTableModel.ATTACHMENTS);
- }
-
- { // Species to confirm column
-
- addBooleanColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
- getTable());
- }
- return columnModel;
- }
-
- @Override
- protected void onRowModified(SpeciesBatchRowModel row,
- String propertyName,
- Object oldValue,
- Object newValue) {
-
- if (RECOMPUTE_TOTAL_WEIGHT.contains(propertyName)) {
-
- // Need to recompute totalHorsVracWeight
- recomputeTotalHorsVrac();
- }
-
- SpeciesBatchUIModel model = getModel();
-
- SpeciesBatchTreeModel samplingTreeModel = model.getSamplingTreeModel();
-
- if (SAMPLING_PROPERTIES.contains(propertyName)) {
-
- // Need to rebuilt this row sampling tree path (and then recompute
- // old super - samplingRatio and new super - samplingRatio)
-
- // old node of the previous sampling def for this row
- // and remove it from any cache
- SpeciesBatchTreeNode oldNode = samplingTreeModel.removeNodeFromCache(row);
-
- boolean rowWasValid = row.isValid();
- if (oldNode != null && rowWasValid) {
-
- // remove this row from his super sampling
- recomputeSuperSamplingRatio(samplingTreeModel, oldNode);
- }
-
- // get new sampling node
- SpeciesBatchTreeNode newNode = samplingTreeModel.getSamplingNode(row);
-
- // check this row is valid
- boolean rowValid = samplingTreeModel.isValid(row, newNode);
-
- // push this state back to the row
- row.setValid(rowValid);
-
- if (rowValid) {
-
- // can add it to his super-sampling
- recomputeSuperSamplingRatio(samplingTreeModel, newNode);
- } else {
-
- if (rowWasValid) {
-
- row.setSampleWeight(null);
- row.setSamplingRatio(null);
-
- getTableModel().updateSamplingRatio(Sets.newHashSet(row));
- }
- }
- }
-
- if (SpeciesBatchRowModel.PROPERTY_WEIGHT.equals(propertyName)) {
-
- // Need to recompute the super - samplingRatio
-
- SpeciesBatchTreeNode node = samplingTreeModel.getSamplingNode(row);
-
- boolean rowWasValid = row.isValid();
-
- // check this row is valid
- boolean rowValid = samplingTreeModel.isValid(row, node);
-
- // push this state back to the row
- row.setValid(rowValid);
-
- if (rowValid) {
- recomputeSuperSamplingRatio(samplingTreeModel, node);
- } else {
- if (rowWasValid) {
-
- // must remove this row from his super-sampling
- recomputeSuperSamplingRatio(samplingTreeModel, node);
-
- row.setSampleWeight(null);
- row.setSamplingRatio(null);
-
- getTableModel().updateSamplingRatio(Sets.newHashSet(row));
- }
- }
- }
- }
-
- @Override
- protected void onRowValidStateChanged(SpeciesBatchRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- int rowIndex = getTableModel().getRowIndex(row);
-
- if (rowIndex > -1) {
- getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
- }
- }
-
- @Override
- protected void onRowModifyStateChanged(SpeciesBatchRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- }
-
- @Override
- protected void saveSelectedRowIfRequired() {
-
- TuttiBeanMonitor<SpeciesBatchRowModel> rowMonitor = getRowMonitor();
-
- SpeciesBatchRowModel bean = rowMonitor.getBean();
- if (bean != null) {
-
- if (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();
- }
- } else {
-
- // row is not valid can not save it
-
- SpeciesBatch catchBean = bean.toBean();
-
- if (!TuttiEntities.isNew(catchBean)) {
-
- // remove this
- persistenceService.deleteSpeciesBatch(catchBean.getId());
- }
- }
- }
- }
-
- @Override
- protected boolean isRowValid(SpeciesBatchRowModel row) {
-
- SpeciesBatchUIModel model = getModel();
-
- SpeciesBatchTreeModel samplingTreeModel = model.getSamplingTreeModel();
- SpeciesBatchTreeNode node = samplingTreeModel.getSamplingNode(row);
- boolean rowValid = samplingTreeModel.isValid(row, node);
- return rowValid;
- }
-
- @Override
- protected void saveRow(SpeciesBatchRowModel row) {
-
- SpeciesBatch catchBean = row.toBean();
-
- FishingOperation fishingOperation = getModel().getFishingOperation();
- catchBean.setFishingOperation(fishingOperation);
- if (log.isInfoEnabled()) {
- log.info("Selected fishingOperation: " + fishingOperation.getId());
- }
-
- if (TuttiEntities.isNew(catchBean)) {
-
- catchBean = persistenceService.createSpeciesBatch(catchBean);
- row.setId(catchBean.getId());
- } else {
- persistenceService.saveSpeciesBatch(catchBean);
- }
-
- List<SpeciesFrequencyRowModel> frequencyRows = row.getFrequency();
-
- List<SpeciesBatchFrequency> frequency =
- SpeciesFrequencyRowModel.toBeans(frequencyRows, catchBean);
-
- if (log.isInfoEnabled()) {
- log.info("Will save " + frequency.size() + " frequencies.");
- }
- frequency = persistenceService.saveSpeciesBatchFrequency(
- catchBean.getId(), frequency);
-
- // push it back to row model
- frequencyRows = SpeciesFrequencyRowModel.fromBeans(frequency);
- row.setFrequency(frequencyRows);
- }
-
- @Override
- public void selectFishingOperation(FishingOperation bean) {
-
- JXTable table = ui.getTable();
-
- if (table.isEditing()) {
-
- // make sure to stop editor
- table.editingCanceled(null);
- }
-
- // make sure selection is empty (will remove bean from monitor)
- table.clearSelection();
-
- boolean empty = bean == null;
-
- SpeciesBatchUIModel model = getModel();
-
- List<SpeciesBatchRowModel> rows;
-
- if (empty) {
- rows = null;
- } else {
-
- if (log.isInfoEnabled()) {
- log.info("Get species batch for fishingOperation: " +
- bean.getId());
- }
- rows = Lists.newArrayList();
-
- if (!TuttiEntities.isNew(bean)) {
- List<SpeciesBatch> catches =
- persistenceService.getAllSpeciesBatch(bean.getId());
- for (SpeciesBatch aBatch : catches) {
- List<SpeciesBatchFrequency> frequencies =
- persistenceService.getAllSpeciesBatchFrequency(aBatch.getId());
- SpeciesBatchRowModel entry =
- new SpeciesBatchRowModel(aBatch, frequencies);
- rows.add(entry);
- }
- }
- }
- model.setRows(rows);
- }
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- public void beforeInitUI() {
-
- if (log.isInfoEnabled()) {
- log.info("beforeInit: " + ui);
- }
-
- EditCatchesUIModel catchesUIModel =
- ui.getContextValue(EditCatchesUIModel.class);
-
- SpeciesBatchUIModel model = new SpeciesBatchUIModel(catchesUIModel);
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- if (log.isInfoEnabled()) {
- log.info("afterInit: " + ui);
- }
-
- initUI(ui);
-
- //TODO Will come from protocol
- List<String> samplingOrder = Lists.newArrayList(
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SIZE_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SEX_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_MATURITY_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_AGE
- );
-
- getModel().setSamplingOrder(samplingOrder);
-
- JXTable table = getTable();
-
- // create table column model
- TableColumnModel columnModel = createTableColumnModel();
-
- // create table model
- SpeciesBatchTableModel tableModel =
- new SpeciesBatchTableModel(columnModel);
-
- table.setModel(tableModel);
- table.setColumnModel(columnModel);
-
- initBatchTable(table, columnModel, tableModel);
- }
-
- @Override
- public void onCloseUI() {
- if (log.isInfoEnabled()) {
- log.info("closing: " + ui);
- }
- }
-
- //------------------------------------------------------------------------//
- //-- Public methods --//
- //------------------------------------------------------------------------//
-
- //------------------------------------------------------------------------//
- //-- Internal methods --//
- //------------------------------------------------------------------------//
-
- protected void recomputeSuperSamplingRatio(SpeciesBatchTreeModel samplingTreeModel,
- SpeciesBatchTreeNode node) {
-
- SpeciesBatchTreeNode superSamplingNode = node.getParent();
-
- Preconditions.checkNotNull(superSamplingNode,
- "Super sampling node can't be null");
-
- SpeciesBatchTreeModel.SamplingContext samplingContext =
- samplingTreeModel.createSamplingContext(superSamplingNode);
-
- float samplingTotalWeight = samplingContext.getTotalWeight();
- Float superSamplingTotalWeight;
- SpeciesBatchRowModel superSamplingRow =
- samplingContext.getSuperSamplingRow();
- if (superSamplingRow == null) {
-
- // Use directly the batch total weight (means no super-sampling)
-
- superSamplingTotalWeight = getModel().getSpeciesTotalWeight();
- } else {
- superSamplingTotalWeight = superSamplingRow.getWeight();
- }
-
- if (log.isInfoEnabled()) {
- log.info("Super sampling total weight: " +
- superSamplingTotalWeight);
- }
-
- Float samplingRatio = null;
- if (superSamplingTotalWeight != null) {
- samplingRatio = samplingTotalWeight / superSamplingTotalWeight;
- }
-
- if (log.isInfoEnabled()) {
- log.info("Sampling ratio: " + samplingRatio);
- }
-
- samplingContext.applyNewSampleValues(samplingTotalWeight,
- samplingRatio);
-
- getTableModel().updateSamplingRatio(samplingContext.getSamplingRows());
- }
-
- protected void recomputeTotalHorsVrac() {
-
- // recompute total hors vrac
- Float totalHorsVrac = 0f;
- Float totalVrac = 0f;
-
- for (SpeciesBatchRowModel batch : getModel().getRows()) {
- CaracteristicQualitativeValue vracHorsVrac =
- batch.getSortedUnsortedCategory();
-
- if (vracHorsVrac == null) {
-
- // can't sum anything
- } else {
- boolean unsorted = "unsorted".equals(vracHorsVrac.getName());
- if (unsorted) {
- Float weight = batch.getWeight();
- if (weight != null) {
- totalHorsVrac += weight;
- }
- } else {
- Float weight = batch.getWeight();
- if (weight != null) {
- totalVrac += weight;
- }
- }
- }
- }
- if (log.isInfoEnabled()) {
- log.info("New total vrac / hors vrac: " +
- totalVrac + " / " + totalHorsVrac);
- }
- getModel().setSpeciesTotalUnsortedWeight(totalHorsVrac);
- //TODO Should we also set the total vrac weight ?
-// getModel().setTotalVracWeight(totalVrac);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,108 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesBatchUIModel extends AbstractTuttiBatchUIModel<SpeciesBatchRowModel, SpeciesBatchUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Sampling order (sets by protocol).
- *
- * @since 0.2
- */
- protected List<String> samplingOrder;
-
- /**
- * Tree of sampling for batch rows.
- *
- * @since 0.2
- */
- protected final SpeciesBatchTreeModel samplingTreeModel;
-
- public SpeciesBatchUIModel(EditCatchesUIModel catchesUIModel) {
- super(catchesUIModel,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_UNSORTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_WEIGHT);
- this.samplingTreeModel = new SpeciesBatchTreeModel();
- }
-
- public Float getSpeciesTotalWeight() {
- return catchesUIModel.getSpeciesTotalWeight();
- }
-
- public void setSpeciesTotalWeight(Float speciesTotalWeight) {
- catchesUIModel.setSpeciesTotalWeight(speciesTotalWeight);
- }
-
- public Float getSpeciesTotalSortedWeight() {
- return catchesUIModel.getSpeciesTotalSortedWeight();
- }
-
- public void setSpeciesTotalSortedWeight(Float speciesTotalSortedWeight) {
- catchesUIModel.setSpeciesTotalSortedWeight(speciesTotalSortedWeight);
- }
-
- public Float getSpeciesTotalSampleSortedWeight() {
- return catchesUIModel.getSpeciesTotalSampleSortedWeight();
- }
-
- public void setSpeciesTotalSampleSortedWeight(Float speciesSampleSortedWeight) {
- catchesUIModel.setSpeciesTotalSampleSortedWeight(speciesSampleSortedWeight);
- }
-
- public Float getSpeciesTotalUnsortedWeight() {
- return catchesUIModel.getSpeciesTotalUnsortedWeight();
- }
-
- public void setSpeciesTotalUnsortedWeight(Float speciesTotalUnsortedWeight) {
- catchesUIModel.setSpeciesTotalUnsortedWeight(speciesTotalUnsortedWeight);
- }
-
- public SpeciesBatchTreeModel getSamplingTreeModel() {
- return samplingTreeModel;
- }
-
- public List<String> getSamplingOrder() {
- return samplingOrder;
- }
-
- public void setSamplingOrder(List<String> samplingOrder) {
- this.samplingOrder = samplingOrder;
- samplingTreeModel.setSamplingOrder(samplingOrder.toArray(new String[samplingOrder.size()]));
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,169 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Ordering;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * Represents a batch frequency row.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class SpeciesFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBatchFrequency, SpeciesFrequencyRowModel> implements Comparable<SpeciesFrequencyRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_LENGTH_STEP = "lengthStep";
-
- public static final String PROPERTY_NUMBER = "number";
-
- public static final String PROPERTY_WEIGHT = "weight";
-
- public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight";
-
- /**
- * Length step.
- *
- * @since 0.2
- */
- protected Float lengthStep;
-
- /**
- * Count of fishes for this lengthStep.
- *
- * @since 0.2
- */
- protected Integer number;
-
- /**
- * Weight of fishes observed.
- *
- * @since 0.2
- */
- protected Float weight;
-
- /**
- * Computed weight from number + relation taille-poids.
- *
- * @since 0.2
- */
- protected Float computedWeight;
-
- protected static final Binder<SpeciesBatchFrequency, SpeciesFrequencyRowModel> fromBeanBinder =
- BinderFactory.newBinder(SpeciesBatchFrequency.class,
- SpeciesFrequencyRowModel.class);
-
- protected static final Binder<SpeciesFrequencyRowModel, SpeciesBatchFrequency> toBeanBinder =
- BinderFactory.newBinder(SpeciesFrequencyRowModel.class,
- SpeciesBatchFrequency.class);
-
- private static final Ordering<Float> ordering = Ordering.natural().nullsFirst();
-
- public static List<SpeciesFrequencyRowModel> fromBeans(List<SpeciesBatchFrequency> frequency) {
- List<SpeciesFrequencyRowModel> result = Lists.newArrayList();
- for (SpeciesBatchFrequency b : frequency) {
- SpeciesFrequencyRowModel model = new SpeciesFrequencyRowModel();
- fromBeanBinder.copy(b, model);
- result.add(model);
- }
- return result;
- }
-
- public static List<SpeciesBatchFrequency> toBeans(List<SpeciesFrequencyRowModel> frequency, SpeciesBatch batch) {
- List<SpeciesBatchFrequency> result = Lists.newArrayList();
- for (SpeciesFrequencyRowModel b : frequency) {
- SpeciesBatchFrequency model = new SpeciesBatchFrequency();
- toBeanBinder.copy(b, model);
- model.setBatch(batch);
- result.add(model);
- }
- return result;
- }
-
- public SpeciesFrequencyRowModel() {
- super(SpeciesBatchFrequency.class, fromBeanBinder, toBeanBinder);
- }
-
- public Float getLengthStep() {
- return lengthStep;
- }
-
- public void setLengthStep(Float lengthStep) {
- Object oldValue = getLengthStep();
- this.lengthStep = lengthStep;
- firePropertyChange(PROPERTY_LENGTH_STEP, oldValue, lengthStep);
- }
-
- public Integer getNumber() {
- return number;
- }
-
- public void setNumber(Integer number) {
- Object oldValue = getNumber();
- this.number = number;
- firePropertyChange(PROPERTY_NUMBER, oldValue, number);
- }
-
- public Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- Object oldValue = getWeight();
- this.weight = weight;
- firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
- }
-
- public Float getComputedWeight() {
- return computedWeight;
- }
-
- public void setComputedWeight(Float computedWeight) {
- Object oldValue = getComputedWeight();
- this.computedWeight = computedWeight;
- firePropertyChange(PROPERTY_COMPUTED_WEIGHT, oldValue, computedWeight);
- }
-
- //TODO Use validator
- @Override
- public boolean isValid() {
- return lengthStep != null && number != null;
- }
-
- @Override
- public int compareTo(SpeciesFrequencyRowModel o) {
- int result = ordering.compare(lengthStep, o.lengthStep);
- return result;
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,146 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Maps;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-import java.util.Map;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * Model of the species frequency table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class SpeciesFrequencyTableModel extends AbstractTuttiTableModel<SpeciesFrequencyRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final ColumnIdentifier<SpeciesFrequencyRowModel> LENGTH_STEP = ColumnIdentifier.newId(
- SpeciesFrequencyRowModel.PROPERTY_LENGTH_STEP,
- n_("tutti.table.species.frequency.header.lengthStep"),
- n_("tutti.table.species.frequency.header.lengthStep"));
-
- public static final ColumnIdentifier<SpeciesFrequencyRowModel> NUMBER = ColumnIdentifier.newId(
- SpeciesFrequencyRowModel.PROPERTY_NUMBER,
- n_("tutti.table.species.frequency.header.number"),
- n_("tutti.table.species.frequency.header.number"));
-
- public static final ColumnIdentifier<SpeciesFrequencyRowModel> WEIGHT = ColumnIdentifier.newId(
- SpeciesFrequencyRowModel.PROPERTY_WEIGHT,
- n_("tutti.table.species.frequency.header.weight"),
- n_("tutti.table.species.frequency.header.weight"));
-
- public static final ColumnIdentifier<SpeciesFrequencyRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
- SpeciesFrequencyRowModel.PROPERTY_COMPUTED_WEIGHT,
- n_("tutti.table.species.frequency.header.computedWeight"),
- n_("tutti.table.species.frequency.header.computedWeight"));
-
- private final SpeciesFrequencyUIModel uiModel;
-
- private final Map<Float, SpeciesFrequencyRowModel> rowCache;
-
- public SpeciesFrequencyTableModel(TableColumnModel columnModel,
- SpeciesFrequencyUIModel uiModel) {
- super(columnModel);
- this.uiModel = uiModel;
- this.rowCache = Maps.newTreeMap();
- setNoneEditableCols(COMPUTED_WEIGHT);
- }
-
- @Override
- protected SpeciesFrequencyRowModel createNewRow() {
- Float defaultStep = null;
-
- int rowCount = getRowCount();
- if (rowCount > 0) {
-
- SpeciesFrequencyRowModel rowModel = getEntry(rowCount - 1);
- Float lengthStep = rowModel.getLengthStep();
- if (lengthStep != null) {
- defaultStep = uiModel.getLengthStep(
- lengthStep + uiModel.getStep());
- }
- }
- SpeciesFrequencyRowModel result = new SpeciesFrequencyRowModel();
- result.setLengthStep(defaultStep);
- result.setValid(false);
- return result;
- }
-
- @Override
- public void setValueAt(Object aValue,
- int rowIndex,
- int columnIndex,
- ColumnIdentifier<SpeciesFrequencyRowModel> propertyName,
- SpeciesFrequencyRowModel entry) {
- super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
- // TODO Rebuild the computedWeight if possible...
- }
-
- public Map<Float, SpeciesFrequencyRowModel> getRowCache() {
- return rowCache;
- }
-
- @Override
- protected void onRowsChanged(List<SpeciesFrequencyRowModel> data) {
-
- // rebuild row cache
- rowCache.clear();
-
- for (SpeciesFrequencyRowModel row : data) {
- Float lengthStep = row.getLengthStep();
- if (lengthStep != null) {
- rowCache.put(lengthStep, row);
- }
- }
- }
-
- @Override
- protected void onRowAdded(int rowIndex, SpeciesFrequencyRowModel newValue) {
-
- Preconditions.checkNotNull(newValue, "can't add a null row");
-
- // add new row to cache
- Float lengthStep = newValue.getLengthStep();
-
- Preconditions.checkNotNull(lengthStep,
- "can't add a null lengthStep row");
-
- float roundLenghtValue = uiModel.getLengthStep(lengthStep);
-
- if (!rowCache.containsKey(roundLenghtValue)) {
-
- rowCache.put(roundLenghtValue, newValue);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,142 +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()};
-}
-
-#stepLabel {
- text: "tutti.label.frequencyConfiguration.step";
- labelFor: {stepField};
-}
-
-#stepField {
- property: "step";
- model: {model.getStep()};
- useFloat: true;
- numberPattern: {DECIMAL1_PATTERN};
- bean: {model};
-}
-
-#minStepLabel {
- text: "tutti.label.frequencyConfiguration.minStep";
- labelFor: {minStepField};
-}
-
-#minStepField {
- property: "minStep";
- model: {model.getMinStep()};
- useFloat: true;
- showReset: true;
- numberPattern: {DECIMAL1_PATTERN};
- bean: {model};
-}
-
-#maxStepLabel {
- text: "tutti.label.frequencyConfiguration.maxStep";
- labelFor: {maxStepField};
-}
-
-#maxStepField {
- property: "maxStep";
- model: {model.getMaxStep()};
- useFloat: true;
- showReset: true;
- numberPattern: {DECIMAL1_PATTERN};
- bean: {model};
-}
-
-#rafaleStepLabel {
- text: "tutti.label.frequencyConfiguration.rafaleStep";
- labelFor: {rafaleStepField};
-}
-
-#rafaleStepField {
- modelType: {Float.class};
- useFloat: true;
- showReset: true;
- numberPattern: {DECIMAL1_PATTERN};
-}
-
-#generateButton {
- actionIcon: "generate";
- text: "tutti.action.generate";
- enabled: {model.isCanGenerate()};
-}
-
-#configurationPanel {
- border: {new TitledBorder(null, _("tutti.legend.frequencyConfiguration"))};
-}
-
-#modeConfigurationLayout {
- selected: {String.valueOf(mode.getSelectedValue())};
-}
-
-#modeConfigurationPanel {
- layout: {modeConfigurationLayout};
-}
-
-#simpleModeButton {
- text: "tutti.label.frequencyConfiguration.mode.simple";
- toolTipText: "tutti.label.frequencyConfiguration.mode.simple.tip";
- value: "simpleMode";
- selected: {model.isSimpleMode()};
- buttonGroup: "mode";
-}
-
-#simpleModeLabel {
- text: "tutti.label.frequencyConfiguration.no.configuration";
- horizontalAlignment: {JLabel.CENTER};
- enabled: false;
-}
-
-#autoGenModeButton {
- text: "tutti.label.frequencyConfiguration.mode.autoGen";
- toolTipText: "tutti.label.frequencyConfiguration.mode.autoGen.tip";
- value: "autoGenMode";
- selected: {model.isAutoGenMode()};
- buttonGroup: "mode";
-}
-
-#rafaleModeButton {
- text: "tutti.label.frequencyConfiguration.mode.rafale";
- toolTipText: "tutti.label.frequencyConfiguration.mode.rafale.tip";
- value: "rafaleMode";
- selected: {model.isRafaleMode()};
- buttonGroup: "mode";
-}
-
-#closeButton {
- actionIcon: "close";
- text: "tutti.action.close";
- mnemonic: F;
-}
-
-#table {
- selectionMode: {ListSelectionModel.SINGLE_SELECTION};
- selectionBackground: {null};
- selectionForeground: {Color.BLACK};
- sortable: false;
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,167 +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<SpeciesFrequencyUIModel, SpeciesFrequencyUIHandler>'>
-
- <import>
- fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchRowModel
-
- jaxx.runtime.swing.CardLayout2Ext
- jaxx.runtime.swing.editor.bean.BeanComboBox
- jaxx.runtime.swing.editor.NumberEditor
-
- org.jdesktop.swingx.JXTable
-
- javax.swing.ListSelectionModel
- javax.swing.SwingConstants
-
- java.awt.Color
- java.awt.Dimension
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
- </import>
-
- <script><![CDATA[
-
- public SpeciesFrequencyUI(TuttiUIContext context) {
- SpeciesFrequencyUIHandler handler = new SpeciesFrequencyUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
- }
-
- public void editBatch(SpeciesBatchRowModel row) {
- handler.editBatch(row);
- }
-
- protected void $afterCompleteSetup() {
- handler.afterInitUI();
- }
- ]]></script>
-
- <SpeciesFrequencyUIHandler id='handler'
- initializer='getContextValue(SpeciesFrequencyUIHandler.class)'/>
-
- <SpeciesFrequencyUIModel id='model'
- initializer='getContextValue(SpeciesFrequencyUIModel.class)'/>
-
- <CardLayout2Ext id='modeConfigurationLayout'
- constructorParams='this, "modeConfigurationPanel"'/>
-
- <JPanel id='configurationPanel' layout='{new BorderLayout()}' constraints='BorderLayout.NORTH'>
-
- <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.CENTER'>
- <VBox id='modePanel' constraints='BorderLayout.WEST'
- verticalAlignment='{SwingConstants.CENTER}'>
- <JRadioButton id='simpleModeButton'
- onActionPerformed='model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE)'/>
- <JRadioButton id='autoGenModeButton'
- onActionPerformed='model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.AUTO_GEN)'/>
- <JRadioButton id='rafaleModeButton'
- onActionPerformed='model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.RAFALE)'/>
- </VBox>
-
- <JPanel id='modeConfigurationPanel' constraints='BorderLayout.CENTER'>
- <JPanel id='simpleModePanel' constraints='"simpleMode"'
- layout='{new BorderLayout()}'>
- <JLabel id='simpleModeLabel' constraints='BorderLayout.CENTER'/>
- </JPanel>
- <JPanel id='autoGenModePanel' constraints='"autoGenMode"'>
- <Table fill='both' constraints='BorderLayout.SOUTH'>
- <!-- Min step-->
- <row>
- <cell anchor='west'>
- <JLabel id='minStepLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='minStepField' constructorParams='this'/>
- </cell>
- </row>
- <!-- Max step-->
- <row>
- <cell anchor='west'>
- <JLabel id='maxStepLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='maxStepField' constructorParams='this'/>
- </cell>
- </row>
- <!-- Actions -->
- <row>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1, 0)}'>
- <JButton id='generateButton'
- onActionPerformed='handler.generateLengthSteps()'/>
- </JPanel>
- </cell>
- </row>
- </Table>
- </JPanel>
- <JPanel id='rafaleModePanel' constraints='"rafaleMode"'>
- <Table fill='both' constraints='BorderLayout.SOUTH'>
- <!-- Rafale step-->
- <row>
- <cell weightx='1.0'>
- <JLabel id='rafaleStepLabel'/>
- </cell>
- </row>
- <row>
- <cell weightx='1.0'>
- <NumberEditor id='rafaleStepField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </JPanel>
- </JPanel>
- <Table fill='both' constraints='BorderLayout.SOUTH'>
- <row>
- <cell columns='2'>
- <JSeparator/>
- </cell>
- </row>
- <!-- Step -->
- <row>
- <cell anchor='west'>
- <JLabel id='stepLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='stepField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </JPanel>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JXTable id='table'/>
- </JScrollPane>
-
- <!-- actions -->
- <JPanel id='actionPanel' layout='{new GridLayout(1, 0)}'
- constraints='BorderLayout.SOUTH'>
- <JButton id='closeButton' onActionPerformed='handler.close()'/>
- </JPanel>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,362 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.ui.swing.TuttiUI;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.decorator.HighlightPredicate;
-import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
-
-import javax.swing.JDialog;
-import javax.swing.table.TableColumnModel;
-import java.awt.Color;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<SpeciesFrequencyRowModel, SpeciesFrequencyUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(SpeciesFrequencyUIHandler.class);
-
- private final SpeciesFrequencyUI ui;
-
- public SpeciesFrequencyUIHandler(TuttiUIContext context,
- SpeciesFrequencyUI ui) {
- super(context,
- SpeciesFrequencyRowModel.PROPERTY_LENGTH_STEP,
- SpeciesFrequencyRowModel.PROPERTY_NUMBER,
- SpeciesFrequencyRowModel.PROPERTY_WEIGHT,
- SpeciesFrequencyRowModel.PROPERTY_COMPUTED_WEIGHT);
- this.ui = ui;
- }
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiTableUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- protected SpeciesFrequencyUIModel getModel() {
- return ui.getModel();
- }
-
- @Override
- protected SpeciesFrequencyTableModel getTableModel() {
- return (SpeciesFrequencyTableModel) getTable().getModel();
- }
-
- @Override
- protected JXTable getTable() {
- return ui.getTable();
- }
-
- @Override
- protected TableColumnModel createTableColumnModel() {
-
- DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
-
- { // LengthStep
-
- addFloatColumnToModel(columnModel,
- SpeciesFrequencyTableModel.LENGTH_STEP,
- TuttiUI.DECIMAL1_PATTERN);
- }
-
- { // Number
-
- addIntegerColumnToModel(columnModel,
- SpeciesFrequencyTableModel.NUMBER,
- TuttiUI.INT_6_DIGITS_PATTERN);
- }
-
- { // Weight
-
- addFloatColumnToModel(columnModel,
- SpeciesFrequencyTableModel.WEIGHT,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // ComputedWeight
-
- addFloatColumnToModel(columnModel,
- SpeciesFrequencyTableModel.COMPUTED_WEIGHT,
- TuttiUI.DECIMAL3_PATTERN);
- }
- return columnModel;
- }
-
- @Override
- protected void onRowModified(SpeciesFrequencyRowModel row,
- String propertyName,
- Object oldValue,
- Object newValue) {
- if (SpeciesFrequencyRowModel.PROPERTY_NUMBER.equals(propertyName)) {
-
- // Need to recompute the computedWeight
- computeComputedWeight(row);
- }
- }
-
- @Override
- protected void onRowValidStateChanged(SpeciesFrequencyRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- }
-
- @Override
- protected void onRowModifyStateChanged(SpeciesFrequencyRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- }
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- public void beforeInitUI() {
-
- SpeciesFrequencyUIModel model = new SpeciesFrequencyUIModel();
-
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- initUI(ui);
-
- JXTable table = getTable();
-
- // create table column model
- TableColumnModel columnModel = createTableColumnModel();
-
- SpeciesFrequencyUIModel model = getModel();
-
- // create table model
- SpeciesFrequencyTableModel tableModel =
- new SpeciesFrequencyTableModel(columnModel, model);
-
- table.setModel(tableModel);
- table.setColumnModel(columnModel);
-
- installTableKeyListener(columnModel, table);
-
- table.getTableHeader().setReorderingAllowed(false);
-
- table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(
- HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
-
- // when model datas change let's propagate it table model
- listenRowsFromModel();
-
- //TODO Should it come from PROTOCOL or config ?
- model.setStep(.5f);
-
- model.setMinStep(10f);
- model.setMaxStep(20f);
-
- //TODO Configure this ?
- model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE);
-
- // always scroll to selected row
- SwingUtil.scrollToTableSelection(getTable());
-
- ui.getRafaleStepField().getTextField().addKeyListener(new KeyAdapter() {
-
- @Override
- public void keyReleased(KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER) {
- e.consume();
- Float step = (Float) ui.getRafaleStepField().getModel();
-
- applyRafaleStep(step);
- }
- }
- });
- }
-
- @Override
- public void onCloseUI() {
- }
-
- //------------------------------------------------------------------------//
- //-- Public methods --//
- //------------------------------------------------------------------------//
-
- public void generateLengthSteps() {
-
- SpeciesFrequencyUIModel model = getModel();
-
- Map<Float, SpeciesFrequencyRowModel> rowsByStep =
- getTableModel().getRowCache();
-
- Float minStep = model.getLengthStep(model.getMinStep());
- Float maxStep = model.getLengthStep(model.getMaxStep());
-
- for (float i = minStep, step = model.getStep(); i <= maxStep; i += step) {
- if (!rowsByStep.containsKey(i)) {
-
- // add it
- SpeciesFrequencyRowModel newRow = new SpeciesFrequencyRowModel();
- newRow.setLengthStep(i);
- rowsByStep.put(i, newRow);
- }
- }
-
- List<SpeciesFrequencyRowModel> rows =
- Lists.newArrayList(rowsByStep.values());
-
- model.setRows(rows);
- }
-
- public void applyRafaleStep(Float step) {
-
- if (log.isInfoEnabled()) {
- log.info("Will apply rafale step: " + step);
- }
- SpeciesFrequencyUIModel model = getModel();
- SpeciesFrequencyTableModel tableModel = getTableModel();
-
- Map<Float, SpeciesFrequencyRowModel> rowsByStep = tableModel.getRowCache();
-
- float aroundLengthStep = model.getLengthStep(step);
-
- SpeciesFrequencyRowModel row = rowsByStep.get(aroundLengthStep);
-
- int rowIndex;
-
- if (row != null) {
-
- // increments current row
- Integer number = row.getNumber();
- row.setNumber((number == null ? 0 : number) + 1);
- rowIndex = tableModel.updateRow(row);
-
- } else {
-
- // create a new row
- row = new SpeciesFrequencyRowModel();
- row.setLengthStep(aroundLengthStep);
- row.setNumber(1);
-
- // get new index
- List<Float> steps = Lists.newArrayList(rowsByStep.keySet());
- steps.add(aroundLengthStep);
-
- Collections.sort(steps);
-
- rowIndex = steps.indexOf(aroundLengthStep);
-
- tableModel.addNewRow(rowIndex, row);
- }
-
- getTable().scrollRowToVisible(rowIndex);
- }
-
- public void editBatch(SpeciesBatchRowModel row) {
-
- List<SpeciesFrequencyRowModel> frequency = null;
- if (row != null) {
- frequency = row.getFrequency();
- }
-
- List<SpeciesFrequencyRowModel> editFrequency;
- if (CollectionUtils.isEmpty(frequency)) {
-
- // new list
- editFrequency = Lists.newArrayList();
- } else {
-
- editFrequency = Lists.newArrayList(frequency);
- }
-
- if (log.isInfoEnabled()) {
- log.info("Will edit batch row: " + row + " with " +
- editFrequency.size() + " frequency");
- }
- getModel().setRows(editFrequency);
-
- // keep batch (will be used to push back editing entry)
- getModel().setBatch(row);
- }
-
- public void close() {
-
- if (log.isInfoEnabled()) {
- log.info("Will close UI " + ui);
- }
-
- // transfer rows to editor
-
- List<SpeciesFrequencyRowModel> frequency = Lists.newArrayList();
- for (SpeciesFrequencyRowModel row : getModel().getRows()) {
- if (row.isValid()) {
-
- // can keep this row
- frequency.add(row);
- }
- }
-
- if (log.isInfoEnabled()) {
- log.info("Push back " + frequency.size() +
- " frequency to batch " + getModel().getBatch());
- }
-
- // push back to batch
- getModel().getBatch().setFrequency(frequency);
-
- ui.editBatch(null);
-
- SwingUtil.getParentContainer(ui, JDialog.class).setVisible(false);
- }
-
- //------------------------------------------------------------------------//
- //-- Internal methods --//
- //------------------------------------------------------------------------//
-
- protected void computeComputedWeight(SpeciesFrequencyRowModel row) {
-
- if (log.isInfoEnabled()) {
- log.info("Will recompute computed weight for frequency: " + row);
- }
- }
-
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -1,174 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class SpeciesFrequencyUIModel extends AbstractTuttiTableUIModel<SpeciesBatchRowModel, SpeciesFrequencyRowModel, SpeciesFrequencyUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_CONFIGURATION_MODE = "configurationMode";
-
- public static final String PROPERTY_STEP = "step";
-
- private static final String PROPERTY_MIN_STEP = "minStep";
-
- private static final String PROPERTY_MAX_STEP = "maxStep";
-
- public static final String PROPERTY_CAN_GENERATE = "canGenerate";
-
- public static final String PROPERTY_SIMPLE_MODE = "simpleMode";
-
- public static final String PROPERTY_AUTO_GEN_MODE = "autoGenMode";
-
- public static final String PROPERTY_RAFALE_MODE = "rafaleMode";
-
- public static enum ConfigurationMode {
- SIMPLE,
- AUTO_GEN,
- RAFALE
- }
-
- /**
- * Fill mode.
- *
- * @since 0.2
- */
- protected ConfigurationMode configurationMode;
-
- /**
- * Batch that contains frequencies.
- *
- * @since 0.2
- */
- protected SpeciesBatchRowModel batch;
-
- /**
- * Default step to increment length step.
- *
- * @since 0.2
- */
- protected float step;
-
- /**
- * Min step to auto generate length steps.
- *
- * @since 0.2
- */
- protected Float minStep;
-
- /**
- * Max step to auto generate length steps.
- *
- * @since 0.2
- */
- protected Float maxStep;
-
- public SpeciesFrequencyUIModel() {
- super(SpeciesBatchRowModel.class, null, null);
- }
-
- public ConfigurationMode getConfigurationMode() {
- return configurationMode;
- }
-
- public void setConfigurationMode(ConfigurationMode configurationMode) {
- Object oldValue = getConfigurationMode();
- this.configurationMode = configurationMode;
- firePropertyChange(PROPERTY_CONFIGURATION_MODE, oldValue, configurationMode);
- firePropertyChange(PROPERTY_SIMPLE_MODE, null, isSimpleMode());
- firePropertyChange(PROPERTY_AUTO_GEN_MODE, null, isAutoGenMode());
- firePropertyChange(PROPERTY_RAFALE_MODE, null, isRafaleMode());
- }
-
- public float getStep() {
- return step;
- }
-
- public void setStep(float step) {
- Object oldValue = getStep();
- this.step = step;
- firePropertyChange(PROPERTY_STEP, oldValue, step);
- }
-
- public Float getMinStep() {
- return minStep;
- }
-
- public void setMinStep(Float minStep) {
- Object oldValue = getMinStep();
- this.minStep = minStep;
- firePropertyChange(PROPERTY_MIN_STEP, oldValue, minStep);
- firePropertyChange(PROPERTY_CAN_GENERATE, null, isCanGenerate());
- }
-
- public Float getMaxStep() {
- return maxStep;
- }
-
- public void setMaxStep(Float maxStep) {
- Object oldValue = getMaxStep();
- this.maxStep = maxStep;
- firePropertyChange(PROPERTY_MAX_STEP, oldValue, maxStep);
- firePropertyChange(PROPERTY_CAN_GENERATE, null, isCanGenerate());
- }
-
- public boolean isSimpleMode() {
- return ConfigurationMode.SIMPLE == configurationMode;
- }
-
- public boolean isAutoGenMode() {
- return ConfigurationMode.AUTO_GEN == configurationMode;
- }
-
- public boolean isRafaleMode() {
- return ConfigurationMode.RAFALE == configurationMode;
- }
-
- public boolean isCanGenerate() {
- return minStep != null && maxStep != null && maxStep > minStep;
- }
-
- public SpeciesBatchRowModel getBatch() {
- return batch;
- }
-
- public void setBatch(SpeciesBatchRowModel batch) {
- this.batch = batch;
- }
-
- public float getLengthStep(float lengthStep) {
- int intValue = (int) (lengthStep * 10);
- int intStep = (int) (step * 10);
- int correctIntStep = intValue - (intValue % intStep);
- float result = correctIntStep / 10f;
- return result;
- }
-}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java
===================================================================
--- trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java 2012-12-21 20:27:17 UTC (rev 104)
+++ trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java 2012-12-21 20:51:46 UTC (rev 105)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesFrequencyRowModel;
import org.junit.Assert;
import org.junit.Test;
1
0
Dec. 21, 2012
Author: tchemit
Date: 2012-12-21 21:27:17 +0100 (Fri, 21 Dec 2012)
New Revision: 104
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/104
Log:
refs #1804: Onglet captures (review as seen with Vincent)
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/
Modified:
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-21 20:27:17 UTC (rev 104)
@@ -40,8 +40,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology.HydrologyTabUI;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology.HydrologyTabUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import javax.swing.event.ListDataEvent;
-import javax.swing.event.ListSelectionEvent;
+import jaxx.runtime.swing.editor.bean.BeanDoubleListModel;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -53,9 +52,6 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;
-import javax.swing.event.ListDataListener;
-import javax.swing.event.ListSelectionListener;
-import jaxx.runtime.swing.editor.bean.BeanDoubleListModel;
/**
@@ -174,24 +170,24 @@
persistenceService.getAllPerson(),
model.getSaisisseur());
final BeanDoubleListModel<Person> saisisseurModel = ui.getSaisisseurList().getModel();
- saisisseurModel.getSelectedModel().addListDataListener(new ListDataListener() {
+// saisisseurModel.getSelectedModel().addListDataListener(new ListDataListener() {
+//
+// public void intervalAdded(ListDataEvent e) {
+// log.info(">>>>>>>>>> intervalAdded " + saisisseurModel.getSelected());
+// ui.getModel().setSaisisseur(saisisseurModel.getSelected());
+// }
+//
+// public void intervalRemoved(ListDataEvent e) {
+// log.info(">>>>>>>>>> intervalRemoved " + saisisseurModel.getSelected());
+// ui.getModel().setSaisisseur(saisisseurModel.getSelected());
+// }
+//
+// public void contentsChanged(ListDataEvent e) {
+// log.info(">>>>>>>>>> contentsChanged " + saisisseurModel.getSelected());
+// ui.getModel().setSaisisseur(saisisseurModel.getSelected());
+// }
+// });
- public void intervalAdded(ListDataEvent e) {
- log.info(">>>>>>>>>> intervalAdded " + saisisseurModel.getSelected());
- ui.getModel().setSaisisseur(saisisseurModel.getSelected());
- }
-
- public void intervalRemoved(ListDataEvent e) {
- log.info(">>>>>>>>>> intervalRemoved " + saisisseurModel.getSelected());
- ui.getModel().setSaisisseur(saisisseurModel.getSelected());
- }
-
- public void contentsChanged(ListDataEvent e) {
- log.info(">>>>>>>>>> contentsChanged " + saisisseurModel.getSelected());
- ui.getModel().setSaisisseur(saisisseurModel.getSelected());
- }
- });
-
String programId = context.getProgramId();
Program program = persistenceService.getProgram(programId);
@@ -301,7 +297,7 @@
}
public void selectFishingOperation(FishingOperation bean) {
-
+
if (fishingOperationMonitor.wasModified()) {
// previous fishingOperation was modified, let's save it
@@ -324,7 +320,7 @@
}
// persist current fishingOperation
- parentUi.getHandler().saveFishingOperation(toSave, false);
+ parentUi.getHandler().saveFishingOperation(toSave);
}
}
@@ -364,6 +360,9 @@
// update saisissuer selection
List<Person> saisisseur = model.getSaisisseur();
+ if (log.isInfoEnabled()) {
+ log.info("Selected saisisseurs: " + saisisseur.size());
+ }
ui.getSaisisseurList().getModel().setSelected(saisisseur);
// update model empty property
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css 2012-12-21 20:27:17 UTC (rev 104)
@@ -41,18 +41,40 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#benthosSampleTotalWeightLabel {
- text: "tutti.label.catches.benthosSampleTotalWeight";
- labelFor: {benthosSampleTotalWeightField};
+#benthosTotalSortedWeightLabel {
+ text: "tutti.label.catches.benthosTotalSortedWeight";
+ labelFor: {benthosTotalSortedWeightField};
}
-#benthosSampleTotalWeightField {
- property: "benthosSampleTotalWeight";
- model: {model.getBenthosSampleTotalWeight()};
+#benthosTotalSortedWeightField {
+ property: "benthosTotalSortedWeight";
+ model: {model.getBenthosTotalSortedWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
+#benthosTotalSampleSortedWeightLabel {
+ text: "tutti.label.catches.benthosTotalSampleSortedWeight";
+ labelFor: {benthosTotalSampleSortedWeightField};
+}
+
+#benthosTotalSampleSortedWeightField {
+ property: "benthosTotalSampleSortedWeight";
+ model: {model.getBenthosTotalSampleSortedWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#benthosTotalUnsortedWeightLabel {
+ text: "tutti.label.catches.benthosTotalUnsortedWeight";
+ labelFor: {benthosTotalUnsortedWeightField};
+}
+
+#benthosTotalUnsortedWeightField {
+ text: {getStringValue(model.getBenthosTotalUnsortedWeight())};
+ editable: false;
+}
+
#table {
selectionMode: {ListSelectionModel.SINGLE_SELECTION};
selectionBackground: {null};
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx 2012-12-21 20:27:17 UTC (rev 104)
@@ -43,6 +43,7 @@
java.awt.Color
static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
</import>
<script><![CDATA[
@@ -68,8 +69,12 @@
<BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
<field name='benthosTotalWeight' component='benthosTotalWeightField'/>
- <field name='benthosSampleTotalWeight'
- component='benthosSampleTotalWeightField'/>
+ <field name='benthosTotalSortedWeight'
+ component='benthosTotalSortedWeightField'/>
+ <field name='benthosTotalSampleSortedWeight'
+ component='benthosTotalSampleSortedWeightField'/>
+ <field name='benthosTotalUnsortedWeight'
+ component='benthosTotalUnsortedWeightField'/>
</BeanValidator>
<LongTextEditorUI id='longTextEditor'/>
@@ -78,7 +83,7 @@
<Table id='form' fill='both' constraints='BorderLayout.NORTH'>
- <!-- Poids total -->
+ <!-- Poids total / Poids total vrac -->
<row>
<cell anchor='west'>
<JLabel id='benthosTotalWeightLabel'/>
@@ -86,17 +91,30 @@
<cell weightx='1.0'>
<NumberEditor id='benthosTotalWeightField' constructorParams='this'/>
</cell>
+ <cell anchor='west'>
+ <JLabel id='benthosTotalSortedWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='benthosTotalSortedWeightField'
+ constructorParams='this'/>
+ </cell>
</row>
- <!-- Poids total échantillonné -->
+ <!-- Poids échantillonné vrac / Poids total hors vrac -->
<row>
<cell>
- <JLabel id='benthosSampleTotalWeightLabel'/>
+ <JLabel id='benthosTotalSampleSortedWeightLabel'/>
</cell>
<cell>
- <NumberEditor id='benthosSampleTotalWeightField'
+ <NumberEditor id='benthosTotalSampleSortedWeightField'
constructorParams='this'/>
</cell>
+ <cell>
+ <JLabel id='benthosTotalUnsortedWeightLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='benthosTotalUnsortedWeightField'/>
+ </cell>
</row>
</Table>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java 2012-12-21 20:27:17 UTC (rev 104)
@@ -38,7 +38,9 @@
public BenthosBatchUIModel(EditCatchesUIModel catchesUIModel) {
super(catchesUIModel,
EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_WEIGHT,
- EditCatchesUIModel.PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT);
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_UNSORTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_WEIGHT);
}
public Float getBenthosTotalWeight() {
@@ -49,11 +51,27 @@
catchesUIModel.setBenthosTotalWeight(benthosTotalWeight);
}
- public Float getBenthosSampleTotalWeight() {
- return catchesUIModel.getBenthosSampleTotalWeight();
+ public Float getBenthosTotalSampleSortedWeight() {
+ return catchesUIModel.getBenthosTotalSampleSortedWeight();
}
- public void setBenthosSampleTotalWeight(Float benthosSampleTotalWeight) {
- catchesUIModel.setBenthosSampleTotalWeight(benthosSampleTotalWeight);
+ public void setBenthosTotalSampleSortedWeight(Float benthosTotalSampleSortedWeight) {
+ catchesUIModel.setBenthosTotalSampleSortedWeight(benthosTotalSampleSortedWeight);
}
+
+ public Float getBenthosTotalSortedWeight() {
+ return catchesUIModel.getBenthosTotalSortedWeight();
+ }
+
+ public void setBenthosTotalSortedWeight(Float benthosTotalSortedWeight) {
+ catchesUIModel.setBenthosTotalSortedWeight(benthosTotalSortedWeight);
+ }
+
+ public Float getBenthosTotalUnsortedWeight() {
+ return catchesUIModel.getBenthosTotalUnsortedWeight();
+ }
+
+ public void setBenthosTotalUnsortedWeight(Float benthosTotalUnsortedWeight) {
+ catchesUIModel.setBenthosTotalUnsortedWeight(benthosTotalUnsortedWeight);
+ }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2012-12-21 20:27:17 UTC (rev 104)
@@ -29,26 +29,72 @@
showReset: true;
}
-#speciesTable {
- border: {BorderFactory.createTitledBorder(_("tutti.legend.speciesCatches"))};
+#catchTable {
+ border: {BorderFactory.createTitledBorder(_("tutti.legend.catch.total"))};
}
-#benthosTable {
- border: {BorderFactory.createTitledBorder(_("tutti.legend.benthosCatches"))};
+#catchTotalWeightLabel {
+ text: "tutti.label.catches.catchTotalWeight";
+ labelFor: {catchTotalWeightField};
}
-#planktonTable {
- border: {BorderFactory.createTitledBorder(_("tutti.legend.planktonCatches"))};
+#catchTotalWeightField {
+ property: "catchTotalWeight";
+ model: {model.getCatchTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
}
-#macroWasteTable {
- border: {BorderFactory.createTitledBorder(_("tutti.legend.macroWasteCatches"))};
+#catchTotalSortedTremisWeightLabel {
+ text: "tutti.label.catches.catchTotalSortedTremisWeight";
+ labelFor: {catchTotalSortedTremisWeightField};
}
-#accidentalTable {
- border: {BorderFactory.createTitledBorder(_("tutti.legend.accidentalCatches"))};
+#catchTotalSortedTremisWeightField {
+ property: "catchTotalSortedTremisWeight";
+ model: {model.getCatchTotalSortedTremisWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
}
+#catchTotalSortedCarousselWeightLabel {
+ text: "tutti.label.catches.catchTotalSortedCarousselWeight";
+ labelFor: {catchTotalSortedCarousselWeightField};
+}
+
+#catchTotalSortedCarousselWeightField {
+ property: "catchTotalSortedCarousselWeight";
+ model: {model.getCatchTotalSortedCarousselWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#catchTotalRejectedWeightLabel {
+ text: "tutti.label.catches.catchTotalRejectedWeight";
+ labelFor: {catchTotalRejectedWeightField};
+}
+
+#catchTotalRejectedWeightField {
+ property: "catchTotalRejectedWeight";
+ model: {model.getCatchTotalRejectedWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#catchTotalUnsortedWeightLabel {
+ text: "tutti.label.catches.catchTotalUnsortedWeight";
+ labelFor: {catchTotalUnsortedWeightField};
+}
+
+#catchTotalUnsortedWeightField {
+ editable: false;
+ text: {getStringValue(model.getCatchTotalUnsortedWeight())};
+}
+
+#speciesTable {
+ border: {BorderFactory.createTitledBorder(_("tutti.legend.catch.species"))};
+}
+
#speciesTotalWeightLabel {
text: "tutti.label.catches.speciesTotalWeight";
labelFor: {speciesTotalWeightField};
@@ -73,14 +119,14 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#speciesSampleSortedWeightLabel {
- text: "tutti.label.catches.speciesSampleSortedWeight";
- labelFor: {speciesSampleSortedWeightField};
+#speciesTotalSampleSortedWeightLabel {
+ text: "tutti.label.catches.speciesTotalSampleSortedWeight";
+ labelFor: {speciesTotalSampleSortedWeightField};
}
-#speciesSampleSortedWeightField {
- property: "speciesSampleSortedWeight";
- model: {model.getSpeciesSampleSortedWeight()};
+#speciesTotalSampleSortedWeightField {
+ property: "speciesTotalSampleSortedWeight";
+ model: {model.getSpeciesTotalSampleSortedWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
@@ -95,6 +141,10 @@
editable: false;
}
+#benthosTable {
+ border: {BorderFactory.createTitledBorder(_("tutti.legend.catch.benthos"))};
+}
+
#benthosTotalWeightLabel {
text: "tutti.label.catches.benthosTotalWeight";
labelFor: {benthosTotalWeightField};
@@ -107,42 +157,49 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#benthosSampleTotalWeightLabel {
- text: "tutti.label.catches.benthosSampleTotalWeight";
- labelFor: {benthosSampleTotalWeightField};
+#benthosTotalSortedWeightLabel {
+ text: "tutti.label.catches.benthosTotalSortedWeight";
+ labelFor: {benthosTotalSortedWeightField};
}
-#benthosSampleTotalWeightField {
- property: "benthosSampleTotalWeight";
- model: {model.getBenthosSampleTotalWeight()};
+#benthosTotalSortedWeightField {
+ property: "benthosTotalSortedWeight";
+ model: {model.getBenthosTotalSortedWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#planktonTotalWeightLabel {
- text: "tutti.label.catches.planktonTotalWeight";
- labelFor: {planktonTotalWeightField};
+#benthosTotalSampleSortedWeightLabel {
+ text: "tutti.label.catches.benthosTotalSampleSortedWeight";
+ labelFor: {benthosTotalSampleSortedWeightField};
}
-#planktonTotalWeightField {
- property: "planktonTotalWeight";
- model: {model.getPlanktonTotalWeight()};
+#benthosTotalSampleSortedWeightField {
+ property: "benthosTotalSampleSortedWeight";
+ model: {model.getBenthosTotalSampleSortedWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#planktonSampleTotalWeightLabel {
- text: "tutti.label.catches.planktonSampleTotalWeight";
- labelFor: {planktonSampleTotalWeightField};
+#benthosTotalUnsortedWeightLabel {
+ text: "tutti.label.catches.benthosTotalUnsortedWeight";
+ labelFor: {benthosTotalUnsortedWeightField};
}
-#planktonSampleTotalWeightField {
- property: "planktonSampleTotalWeight";
- model: {model.getPlanktonSampleTotalWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
+#benthosTotalUnsortedWeightField {
+ text: {getStringValue(model.getBenthosTotalUnsortedWeight())};
+ editable: false;
}
+#otherTable {
+ border: {BorderFactory.createTitledBorder(_("tutti.legend.catch.other"))};
+}
+
+#planktonObservedCheckBox {
+ text: "tutti.label.catches.planktonObserved";
+ selected: {model.isPlanktonObserved()};
+}
+
#macroWasteTotalWeightLabel {
text: "tutti.label.catches.macroWasteTotalWeight";
labelFor: {macroWasteTotalWeightField};
@@ -155,6 +212,11 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
+#accidentalObservedCheckBox {
+ text: "tutti.label.catches.accidentalObserved";
+ selected: {model.isAccidentalObserved()};
+}
+
#importPupitriButton {
actionIcon: "pupitri-import";
text: "tutti.action.pupitri-import";
@@ -163,3 +225,5 @@
#observationIndividuelTab {
enabled: {false};
}
+
+//#catchesCaracteristicsTabScrollPane { }
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2012-12-21 20:27:17 UTC (rev 104)
@@ -66,22 +66,31 @@
<BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='speciesTotalWeight'
- component='speciesTotalWeightField'/>
+ <field name='catchTotalWeight' component='catchTotalWeightField'/>
+ <field name='catchTotalSortedTremisWeight'
+ component='catchTotalSortedTremisWeightField'/>
+ <field name='catchTotalSortedCarousselWeight'
+ component='catchTotalSortedCarousselWeightField'/>
+ <field name='catchTotalRejectedWeight'
+ component='catchTotalRejectedWeightField'/>
+
<field name='speciesTotalSortedWeight'
component='speciesTotalSortedWeightField'/>
- <field name='speciesSampleSortedWeight'
- component='speciesSampleSortedWeightField'/>
+ <field name='speciesTotalSampleSortedWeight'
+ component='speciesTotalSampleSortedWeightField'/>
<field name='speciesTotalUnsortedWeight'
component='speciesTotalUnsortedWeightField'/>
- <field name='benthosTotalWeight'
- component='benthosTotalWeightField'/>
- <field name='benthosSampleTotalWeight'
- component='benthosSampleTotalWeightField'/>
- <field name='planktonTotalWeight'
- component='planktonTotalWeightField'/>
- <field name='planktonSampleTotalWeight'
- component='planktonSampleTotalWeightField'/>
+
+ <field name='benthosTotalSortedWeight'
+ component='benthosTotalSortedWeightField'/>
+ <field name='benthosTotalSampleSortedWeight'
+ component='benthosTotalSampleSortedWeightField'/>
+ <field name='benthosTotalUnsortedWeight'
+ component='benthosTotalUnsortedWeightField'/>
+
+ <field name='planktonObserved' component='planktonObservedCheckBox'/>
+ <field name='accidentalObserved' component='accidentalObservedCheckBox'/>
+
<field name='macroWasteTotalWeight'
component='macroWasteTotalWeightField'/>
</BeanValidator>
@@ -89,133 +98,193 @@
<JTabbedPane id='tabPane' constraints='BorderLayout.CENTER'>
<tab id='catchesCaracteristicsTab'
title='tutti.label.tab.catchesCaracteristics'>
- <JXTitledPanel id='catchesTabsFishingOperationReminderLabel'>
- <JPanel layout='{new BorderLayout()}'>
- <Table id="catchesForm" fill='both' weightx='1'
- constraints='BorderLayout.NORTH'>
- <row>
- <cell columns="2">
- <Table id='speciesTable' fill='both'>
+ <JXTitledPanel id='catchesCaracteristicsTabPane'>
+ <JScrollPane id='catchesCaracteristicsTabScrollPane'>
+ <JPanel layout='{new BorderLayout()}'>
+ <Table id="catchesForm" fill='both' weightx='1'
+ constraints='BorderLayout.NORTH'>
+ <row>
+ <cell>
+ <Table id='catchTable' fill='both'>
- <!-- Poids total / Poids total vrac -->
- <row>
- <cell anchor='west'>
- <JLabel id='speciesTotalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='speciesTotalWeightField'
- constructorParams='this'/>
- </cell>
- <cell anchor='west'>
- <JLabel id='speciesTotalSortedWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='speciesTotalSortedWeightField'
- constructorParams='this'/>
- </cell>
- </row>
+ <!-- Poids total capture -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='catchTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='catchTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell columns="2">
+ </cell>
+ </row>
+ <!-- Poids total trié balance tremis / caroussel-->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='catchTotalSortedTremisWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='catchTotalSortedTremisWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='catchTotalSortedCarousselWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='catchTotalSortedCarousselWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
- <!-- Poids échantillonné vrac / Poids total hors vrac -->
- <row>
- <cell>
- <JLabel id='speciesSampleSortedWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='speciesSampleSortedWeightField'
- constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='speciesTotalUnsortedWeightLabel'/>
- </cell>
- <cell>
- <JTextField id='speciesTotalUnsortedWeightField'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell weightx="0.5">
- <Table id='benthosTable' fill='both'>
+ <!-- Poids total rejeté / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='catchTotalRejectedWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='catchTotalRejectedWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='catchTotalUnsortedWeightLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='catchTotalUnsortedWeightField'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <Table id='speciesTable' fill='both'>
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='benthosTotalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='benthosTotalWeightField'
- constructorParams='this'/>
- </cell>
- </row>
+ <!-- Poids total capture / Poids total vrac -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='speciesTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='speciesTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='speciesTotalSortedWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='speciesTotalSortedWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='benthosSampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='benthosSampleTotalWeightField'
- constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell weightx="0.5">
- <Table id='planktonTable' fill='both'>
+ <!-- Poids total échantillonné vrac / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='speciesTotalSampleSortedWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='speciesTotalSampleSortedWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='speciesTotalUnsortedWeightLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='speciesTotalUnsortedWeightField'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <Table id='benthosTable' fill='both'>
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='planktonTotalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='planktonTotalWeightField'
- constructorParams='this'/>
- </cell>
- </row>
+ <!-- Poids total capture / Poids total vrac -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='benthosTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='benthosTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='benthosTotalSortedWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='benthosTotalSortedWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='planktonSampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='planktonSampleTotalWeightField'
- constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell columns="2">
- <Table id='macroWasteTable' fill='both'>
+ <!-- Poids total échantillonné vrac / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='benthosTotalSampleSortedWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='benthosTotalSampleSortedWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='benthosTotalUnsortedWeightLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='benthosTotalUnsortedWeightField'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <Table id='otherTable' fill='both'>
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='macroWasteTotalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='macroWasteTotalWeightField'
- constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <!-- Actions d'import -->
- <row>
- <cell columns='6'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton id='importPupitriButton'
- onActionPerformed='handler.importPupitri()'/>
- </JPanel>
- </cell>
- </row>
- </Table>
- </JPanel>
+ <!-- Plankton observed -->
+ <row>
+ <cell columns='2'>
+ <JCheckBox id='planktonObservedCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "planktonObserved")'/>
+ </cell>
+ </row>
+ <!-- Accidental observed -->
+ <row>
+ <cell columns='2'>
+ <JCheckBox id='accidentalObservedCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "accidentalObserved")'/>
+ </cell>
+ </row>
+
+ <!-- Poids total Macro dechet -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='macroWasteTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='macroWasteTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+
+ </Table>
+ </cell>
+ </row>
+
+ <!-- Actions d'import -->
+ <row>
+ <cell>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='importPupitriButton'
+ onActionPerformed='handler.importPupitri()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </JScrollPane>
</JXTitledPanel>
</tab>
<tab id='speciesTab' title='tutti.label.tab.species'>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2012-12-21 20:27:17 UTC (rev 104)
@@ -71,11 +71,11 @@
EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_WEIGHT,
EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_UNSORTED_WEIGHT,
EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_SAMPLE_SORTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_WEIGHT,
EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_WEIGHT,
- EditCatchesUIModel.PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_WEIGHT,
EditCatchesUIModel.PROPERTY_PLANKTON_TOTAL_WEIGHT,
- EditCatchesUIModel.PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_PLANKTON_TOTAL_SAMPLE_WEIGHT,
EditCatchesUIModel.PROPERTY_MACRO_WASTE_TOTAL_WEIGHT);
}
@@ -149,7 +149,7 @@
fishingOperationMonitor.clearModified();
- ui.getCatchesTabsFishingOperationReminderLabel().setTitle(fishingOperationText);
+ ui.getCatchesCaracteristicsTabPane().setTitle(fishingOperationText);
ui.getSpeciesTabFishingOperationReminderLabel().setTitle(fishingOperationText);
ui.getBenthosTabFishingOperationReminderLabel().setTitle(fishingOperationText);
ui.getPlanktonTabFishingOperationReminderLabel().setTitle(fishingOperationText);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2012-12-21 20:27:17 UTC (rev 104)
@@ -37,24 +37,42 @@
private static final long serialVersionUID = 1L;
+ public static final String PROPERTY_CATCH_TOTAL_WEIGHT = "catchTotalWeight";
+
+ public static final String PROPERTY_CATCH_TOTAL_SORTED_TREMIS_WEIGHT = "catchTotalSortedTremisWeight";
+
+ public static final String PROPERTY_CATCH_TOTAL_SORTED_CAROUSSEL_WEIGHT = "catchTotalSortedCarousselWeight";
+
+ public static final String PROPERTY_CATCH_TOTAL_REJECTED_WEIGHT = "catchTotalRejectedWeight";
+
+ public static final String PROPERTY_CATCH_TOTAL_UNSORTED_WEIGHT = "catchTotalUnsortedWeight";
+
public static final String PROPERTY_SPECIES_TOTAL_WEIGHT = "speciesTotalWeight";
public static final String PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT = "speciesTotalSortedWeight";
- public static final String PROPERTY_SPECIES_SAMPLE_SORTED_WEIGHT = "speciesSampleSortedWeight";
+ public static final String PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_WEIGHT = "speciesTotalSampleSortedWeight";
public static final String PROPERTY_SPECIES_TOTAL_UNSORTED_WEIGHT = "speciesTotalUnsortedWeight";
public static final String PROPERTY_BENTHOS_TOTAL_WEIGHT = "benthosTotalWeight";
- public static final String PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT = "benthosSampleTotalWeight";
+ public static final String PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT = "benthosTotalSortedWeight";
+ public static final String PROPERTY_BENTHOS_TOTAL_UNSORTED_WEIGHT = "benthosTotalUnsortedWeight";
+
+ public static final String PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_WEIGHT = "benthosTotalSampleSortedWeight";
+
+ public static final String PROPERTY_PLANKTON_OBSERVED = "planktonObserved";
+
public static final String PROPERTY_PLANKTON_TOTAL_WEIGHT = "planktonTotalWeight";
- public static final String PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT = "planktonSampleTotalWeight";
+ public static final String PROPERTY_PLANKTON_TOTAL_SAMPLE_WEIGHT = "planktonTotalSampleWeight";
public static final String PROPERTY_MACRO_WASTE_TOTAL_WEIGHT = "macroWasteTotalWeight";
+ public static final String PROPERTY_ACCIDENTAL_OBSERVED = "accidentalObserved";
+
public static final String PROPERTY_FISHING_OPERATION = "fishingOperation";
protected static final Binder<FishingOperation, EditCatchesUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, EditCatchesUIModel.class)
@@ -62,11 +80,15 @@
PROPERTY_SPECIES_TOTAL_WEIGHT,
PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT,
PROPERTY_SPECIES_TOTAL_UNSORTED_WEIGHT,
- PROPERTY_SPECIES_SAMPLE_SORTED_WEIGHT,
+ PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_WEIGHT,
PROPERTY_BENTHOS_TOTAL_WEIGHT,
- PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT,
+ PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT,
+ PROPERTY_BENTHOS_TOTAL_UNSORTED_WEIGHT,
+ PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_WEIGHT,
+ PROPERTY_PLANKTON_OBSERVED,
+ PROPERTY_ACCIDENTAL_OBSERVED,
PROPERTY_PLANKTON_TOTAL_WEIGHT,
- PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT,
+ PROPERTY_PLANKTON_TOTAL_SAMPLE_WEIGHT,
PROPERTY_MACRO_WASTE_TOTAL_WEIGHT
).toBinder();
@@ -75,11 +97,15 @@
PROPERTY_SPECIES_TOTAL_WEIGHT,
PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT,
PROPERTY_SPECIES_TOTAL_UNSORTED_WEIGHT,
- PROPERTY_SPECIES_SAMPLE_SORTED_WEIGHT,
+ PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_WEIGHT,
PROPERTY_BENTHOS_TOTAL_WEIGHT,
- PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT,
+ PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT,
+ PROPERTY_BENTHOS_TOTAL_UNSORTED_WEIGHT,
+ PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_WEIGHT,
+ PROPERTY_PLANKTON_OBSERVED,
+ PROPERTY_ACCIDENTAL_OBSERVED,
PROPERTY_PLANKTON_TOTAL_WEIGHT,
- PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT,
+ PROPERTY_PLANKTON_TOTAL_SAMPLE_WEIGHT,
PROPERTY_MACRO_WASTE_TOTAL_WEIGHT
).toBinder();
@@ -87,20 +113,38 @@
protected Float speciesTotalSortedWeight;
- protected Float speciesSampleSortedWeight;
+ protected Float speciesTotalSampleSortedWeight;
protected Float speciesTotalUnsortedWeight;
protected Float benthosTotalWeight;
- protected Float benthosSampleTotalWeight;
+ protected Float benthosTotalSortedWeight;
+ protected Float benthosTotalUnsortedWeight;
+
+ protected Float benthosTotalSampleSortedWeight;
+
+ protected boolean planktonObserved;
+
protected Float planktonTotalWeight;
- protected Float planktonSampleTotalWeight;
+ protected Float planktonTotalSampleWeight;
protected Float macroWasteTotalWeight;
+ protected Float catchTotalWeight;
+
+ protected Float catchTotalSortedTremisWeight;
+
+ protected Float catchTotalSortedCarousselWeight;
+
+ protected Float catchTotalRejectedWeight;
+
+ protected Float catchTotalUnsortedWeight;
+
+ protected boolean accidentalObserved;
+
protected FishingOperation fishingOperation;
public EditCatchesUIModel() {
@@ -117,6 +161,56 @@
firePropertyChange(PROPERTY_FISHING_OPERATION, oldValue, fishingOperation);
}
+ public Float getCatchTotalWeight() {
+ return catchTotalWeight;
+ }
+
+ public void setCatchTotalWeight(Float catchTotalWeight) {
+ Object oldValue = getCatchTotalWeight();
+ this.catchTotalWeight = catchTotalWeight;
+ firePropertyChange(PROPERTY_CATCH_TOTAL_WEIGHT, oldValue, catchTotalWeight);
+ }
+
+ public Float getCatchTotalSortedTremisWeight() {
+ return catchTotalSortedTremisWeight;
+ }
+
+ public void setCatchTotalSortedTremisWeight(Float catchTotalSortedTremisWeight) {
+ Object oldValue = getCatchTotalSortedTremisWeight();
+ this.catchTotalSortedTremisWeight = catchTotalSortedTremisWeight;
+ firePropertyChange(PROPERTY_CATCH_TOTAL_SORTED_TREMIS_WEIGHT, oldValue, catchTotalSortedTremisWeight);
+ }
+
+ public Float getCatchTotalSortedCarousselWeight() {
+ return catchTotalSortedCarousselWeight;
+ }
+
+ public void setCatchTotalSortedCarousselWeight(Float catchTotalSortedCarousselWeight) {
+ Object oldValue = getCatchTotalSortedCarousselWeight();
+ this.catchTotalSortedCarousselWeight = catchTotalSortedCarousselWeight;
+ firePropertyChange(PROPERTY_CATCH_TOTAL_SORTED_CAROUSSEL_WEIGHT, oldValue, catchTotalSortedCarousselWeight);
+ }
+
+ public Float getCatchTotalRejectedWeight() {
+ return catchTotalRejectedWeight;
+ }
+
+ public void setCatchTotalRejectedWeight(Float catchTotalRejectedWeight) {
+ Object oldValue = getCatchTotalRejectedWeight();
+ this.catchTotalRejectedWeight = catchTotalRejectedWeight;
+ firePropertyChange(PROPERTY_CATCH_TOTAL_REJECTED_WEIGHT, oldValue, catchTotalRejectedWeight);
+ }
+
+ public Float getCatchTotalUnsortedWeight() {
+ return catchTotalUnsortedWeight;
+ }
+
+ public void setCatchTotalUnsortedWeight(Float catchTotalUnsortedWeight) {
+ Object oldValue = getCatchTotalUnsortedWeight();
+ this.catchTotalUnsortedWeight = catchTotalUnsortedWeight;
+ firePropertyChange(PROPERTY_CATCH_TOTAL_UNSORTED_WEIGHT, oldValue, catchTotalUnsortedWeight);
+ }
+
public Float getSpeciesTotalWeight() {
return speciesTotalWeight;
}
@@ -137,14 +231,14 @@
firePropertyChange(PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT, oldValue, speciesTotalSortedWeight);
}
- public Float getSpeciesSampleSortedWeight() {
- return speciesSampleSortedWeight;
+ public Float getSpeciesTotalSampleSortedWeight() {
+ return speciesTotalSampleSortedWeight;
}
- public void setSpeciesSampleSortedWeight(Float speciesSampleSortedWeight) {
- Object oldValue = getSpeciesSampleSortedWeight();
- this.speciesSampleSortedWeight = speciesSampleSortedWeight;
- firePropertyChange(PROPERTY_SPECIES_SAMPLE_SORTED_WEIGHT, oldValue, speciesSampleSortedWeight);
+ public void setSpeciesTotalSampleSortedWeight(Float speciesTotalSampleSortedWeight) {
+ Object oldValue = getSpeciesTotalSampleSortedWeight();
+ this.speciesTotalSampleSortedWeight = speciesTotalSampleSortedWeight;
+ firePropertyChange(PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_WEIGHT, oldValue, speciesTotalSampleSortedWeight);
}
public Float getSpeciesTotalUnsortedWeight() {
@@ -167,16 +261,56 @@
firePropertyChange(PROPERTY_BENTHOS_TOTAL_WEIGHT, oldValue, benthosTotalWeight);
}
- public Float getBenthosSampleTotalWeight() {
- return benthosSampleTotalWeight;
+ public Float getBenthosTotalSampleSortedWeight() {
+ return benthosTotalSampleSortedWeight;
}
- public void setBenthosSampleTotalWeight(Float benthosSampleTotalWeight) {
- Object oldValue = getBenthosSampleTotalWeight();
- this.benthosSampleTotalWeight = benthosSampleTotalWeight;
- firePropertyChange(PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT, oldValue, benthosSampleTotalWeight);
+ public void setBenthosTotalSampleSortedWeight(Float benthosTotalSampleSortedWeight) {
+ Object oldValue = getBenthosTotalSampleSortedWeight();
+ this.benthosTotalSampleSortedWeight = benthosTotalSampleSortedWeight;
+ firePropertyChange(PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_WEIGHT, oldValue, benthosTotalSampleSortedWeight);
}
+ public Float getBenthosTotalSortedWeight() {
+ return benthosTotalSortedWeight;
+ }
+
+ public void setBenthosTotalSortedWeight(Float benthosTotalSortedWeight) {
+ Object oldValue = getBenthosTotalSortedWeight();
+ this.benthosTotalSortedWeight = benthosTotalSortedWeight;
+ firePropertyChange(PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT, oldValue, benthosTotalSortedWeight);
+ }
+
+ public Float getBenthosTotalUnsortedWeight() {
+ return benthosTotalUnsortedWeight;
+ }
+
+ public void setBenthosTotalUnsortedWeight(Float benthosTotalUnsortedWeight) {
+ Object oldValue = getBenthosTotalUnsortedWeight();
+ this.benthosTotalUnsortedWeight = benthosTotalUnsortedWeight;
+ firePropertyChange(PROPERTY_BENTHOS_TOTAL_UNSORTED_WEIGHT, oldValue, benthosTotalUnsortedWeight);
+ }
+
+ public boolean isPlanktonObserved() {
+ return planktonObserved;
+ }
+
+ public void setPlanktonObserved(boolean planktonObserved) {
+ Object oldValue = isPlanktonObserved();
+ this.planktonObserved = planktonObserved;
+ firePropertyChange(PROPERTY_PLANKTON_OBSERVED, oldValue, planktonObserved);
+ }
+
+ public boolean isAccidentalObserved() {
+ return accidentalObserved;
+ }
+
+ public void setAccidentalObserved(boolean accidentalObserved) {
+ Object oldValue = isAccidentalObserved();
+ this.accidentalObserved = accidentalObserved;
+ firePropertyChange(PROPERTY_ACCIDENTAL_OBSERVED, oldValue, accidentalObserved);
+ }
+
public Float getPlanktonTotalWeight() {
return planktonTotalWeight;
}
@@ -187,14 +321,14 @@
firePropertyChange(PROPERTY_PLANKTON_TOTAL_WEIGHT, oldValue, planktonTotalWeight);
}
- public Float getPlanktonSampleTotalWeight() {
- return planktonSampleTotalWeight;
+ public Float getPlanktonTotalSampleWeight() {
+ return planktonTotalSampleWeight;
}
- public void setPlanktonSampleTotalWeight(Float planktonSampleTotalWeight) {
- Object oldValue = getPlanktonSampleTotalWeight();
- this.planktonSampleTotalWeight = planktonSampleTotalWeight;
- firePropertyChange(PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT, oldValue, planktonSampleTotalWeight);
+ public void setPlanktonTotalSampleWeight(Float planktonTotalSampleWeight) {
+ Object oldValue = getPlanktonTotalSampleWeight();
+ this.planktonTotalSampleWeight = planktonTotalSampleWeight;
+ firePropertyChange(PROPERTY_PLANKTON_TOTAL_SAMPLE_WEIGHT, oldValue, planktonTotalSampleWeight);
}
public Float getMacroWasteTotalWeight() {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css 2012-12-21 20:27:17 UTC (rev 104)
@@ -41,14 +41,14 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#planktonSampleTotalWeightLabel {
- text: "tutti.label.catches.planktonSampleTotalWeight";
- labelFor: {planktonSampleTotalWeightField};
+#planktonTotalSampleWeightLabel {
+ text: "tutti.label.catches.planktonTotalSampleWeight";
+ labelFor: {planktonTotalSampleWeightField};
}
-#planktonSampleTotalWeightField {
- property: "planktonSampleTotalWeight";
- model: {model.getPlanktonSampleTotalWeight()};
+#planktonTotalSampleWeightField {
+ property: "planktonTotalSampleWeight";
+ model: {model.getPlanktonTotalSampleWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx 2012-12-21 20:27:17 UTC (rev 104)
@@ -67,8 +67,8 @@
<BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
<field name='planktonTotalWeight' component='planktonTotalWeightField'/>
- <field name='planktonSampleTotalWeight'
- component='planktonSampleTotalWeightField'/>
+ <field name='planktonTotalSampleWeight'
+ component='planktonTotalSampleWeightField'/>
</BeanValidator>
<LongTextEditorUI id='longTextEditor'/>
@@ -90,10 +90,10 @@
<!-- Poids total échantillonné -->
<row>
<cell>
- <JLabel id='planktonSampleTotalWeightLabel'/>
+ <JLabel id='planktonTotalSampleWeightLabel'/>
</cell>
<cell>
- <NumberEditor id='planktonSampleTotalWeightField'
+ <NumberEditor id='planktonTotalSampleWeightField'
constructorParams='this'/>
</cell>
</row>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java 2012-12-21 20:27:17 UTC (rev 104)
@@ -38,7 +38,7 @@
public PlanktonBatchUIModel(EditCatchesUIModel catchesUIModel) {
super(catchesUIModel,
EditCatchesUIModel.PROPERTY_PLANKTON_TOTAL_WEIGHT,
- EditCatchesUIModel.PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT);
+ EditCatchesUIModel.PROPERTY_PLANKTON_TOTAL_SAMPLE_WEIGHT);
}
public Float getPlanktonTotalWeight() {
@@ -49,11 +49,11 @@
catchesUIModel.setPlanktonTotalWeight(planktonTotalWeight);
}
- public Float getPlanktonSampleTotalWeight() {
- return catchesUIModel.getPlanktonSampleTotalWeight();
+ public Float getPlanktonTotalSampleWeight() {
+ return catchesUIModel.getPlanktonTotalSampleWeight();
}
- public void setPlanktonSampleTotalWeight(Float planktonSampleTotalWeight) {
- catchesUIModel.setPlanktonSampleTotalWeight(planktonSampleTotalWeight);
+ public void setPlanktonTotalSampleWeight(Float planktonTotalSampleWeight) {
+ catchesUIModel.setPlanktonTotalSampleWeight(planktonTotalSampleWeight);
}
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css 2012-12-21 20:27:17 UTC (rev 104)
@@ -53,14 +53,14 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#speciesSampleSortedWeightLabel {
- text: "tutti.label.catches.speciesSampleSortedWeight";
- labelFor: {speciesSampleSortedWeightField};
+#speciesTotalSampleSortedWeightLabel {
+ text: "tutti.label.catches.speciesTotalSampleSortedWeight";
+ labelFor: {speciesTotalSampleSortedWeightField};
}
-#speciesSampleSortedWeightField {
- property: "speciesSampleSortedWeight";
- model: {model.getSpeciesSampleSortedWeight()};
+#speciesTotalSampleSortedWeightField {
+ property: "speciesTotalSampleSortedWeight";
+ model: {model.getSpeciesTotalSampleSortedWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx 2012-12-21 20:27:17 UTC (rev 104)
@@ -71,8 +71,8 @@
<field name='speciesTotalWeight' component='speciesTotalWeightField'/>
<field name='speciesTotalSortedWeight'
component='speciesTotalSortedWeightField'/>
- <field name='speciesSampleSortedWeight'
- component='speciesSampleSortedWeightField'/>
+ <field name='speciesTotalSampleSortedWeight'
+ component='speciesTotalSampleSortedWeightField'/>
<field name='speciesTotalUnsortedWeight'
component='speciesTotalUnsortedWeightField'/>
</BeanValidator>
@@ -105,10 +105,10 @@
<!-- Poids échantillonné vrac / Poids total hors vrac -->
<row>
<cell>
- <JLabel id='speciesSampleSortedWeightLabel'/>
+ <JLabel id='speciesTotalSampleSortedWeightLabel'/>
</cell>
<cell>
- <NumberEditor id='speciesSampleSortedWeightField'
+ <NumberEditor id='speciesTotalSampleSortedWeightField'
constructorParams='this'/>
</cell>
<cell>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java 2012-12-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java 2012-12-21 20:27:17 UTC (rev 104)
@@ -56,7 +56,7 @@
EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_WEIGHT,
EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT,
EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_UNSORTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_SAMPLE_SORTED_WEIGHT);
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_WEIGHT);
this.samplingTreeModel = new SpeciesBatchTreeModel();
}
@@ -76,12 +76,12 @@
catchesUIModel.setSpeciesTotalSortedWeight(speciesTotalSortedWeight);
}
- public Float getSpeciesSampleSortedWeight() {
- return catchesUIModel.getSpeciesSampleSortedWeight();
+ public Float getSpeciesTotalSampleSortedWeight() {
+ return catchesUIModel.getSpeciesTotalSampleSortedWeight();
}
- public void setSpeciesSampleSortedWeight(Float speciesSampleSortedWeight) {
- catchesUIModel.setSpeciesSampleSortedWeight(speciesSampleSortedWeight);
+ public void setSpeciesTotalSampleSortedWeight(Float speciesSampleSortedWeight) {
+ catchesUIModel.setSpeciesTotalSampleSortedWeight(speciesSampleSortedWeight);
}
public Float getSpeciesTotalUnsortedWeight() {
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-21 17:33:19 UTC (rev 103)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-21 20:27:17 UTC (rev 104)
@@ -45,12 +45,21 @@
tutti.label.attachmentEditor.file=Fichier
tutti.label.attachmentEditor.fileComment=Commentaire
tutti.label.attachmentEditor.fileName=Nom
-tutti.label.catches.benthosSampleTotalWeight=Poids total échantillonné
+tutti.label.catches.accidentalObserved=Captures accidentelles observées ?
+tutti.label.catches.benthosTotalSampleSortedWeight=Poids total vrac échantillonné
+tutti.label.catches.benthosTotalSortedWeight=Poids total vrac
+tutti.label.catches.benthosTotalUnsortedWeight=Poids total hors vrac
tutti.label.catches.benthosTotalWeight=Poids total
-tutti.label.catches.macroWasteTotalWeight=Poids total
-tutti.label.catches.planktonSampleTotalWeight=Poids total échantillonné
+tutti.label.catches.catchTotalRejectedWeight=Poids total rejeté
+tutti.label.catches.catchTotalSortedCarousselWeight=Poids total vrac (Caroussel)
+tutti.label.catches.catchTotalSortedTremisWeight=Poids total vrac (Tremis)
+tutti.label.catches.catchTotalUnsortedWeight=Poids total hors vrac
+tutti.label.catches.catchTotalWeight=Poids total
+tutti.label.catches.macroWasteTotalWeight=Poids total Macro déchets
+tutti.label.catches.planktonObserved=Plancton observé ?
+tutti.label.catches.planktonTotalSampleWeight=Poids total échantillonné
tutti.label.catches.planktonTotalWeight=Poids total
-tutti.label.catches.speciesSampleSortedWeight=Poids total vrac échantillon
+tutti.label.catches.speciesTotalSampleSortedWeight=Poids total vrac échantillon
tutti.label.catches.speciesTotalSortedWeight=Poids total vrac
tutti.label.catches.speciesTotalUnsortedWeight=Poids total hors vrac
tutti.label.catches.speciesTotalWeight=Poids total
@@ -138,12 +147,12 @@
tutti.label.tab.plancton=Plancton
tutti.label.tab.species=Espèces
tutti.label.traitReminder=Trait \: %s
-tutti.legend.accidentalCatches=Captures accidentelles
-tutti.legend.benthosCatches=Captures benthos
+tutti.legend.catch.benthos=Benthos
+tutti.legend.catch.other=Autres
+tutti.legend.catch.species=Espèces
+tutti.legend.catch.total=Capture
tutti.legend.frequencyConfiguration=Configuration
-tutti.legend.macroWasteCatches=Captures macro déchets
-tutti.legend.planktonCatches=Captures plancton
-tutti.legend.speciesCatches=Captures espèces
+tutti.legend.macroWasteCatches=Macro déchets
tutti.menu.actions=Actions
tutti.menu.actions.tip=Actions
tutti.menu.file=Fichier
1
0
r103 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing: content/operation content/operation/fishing/environment content/operation/fishing/gearshooting content/operation/fishing/hydrology util/table
by kmorin@users.forge.codelutin.com Dec. 21, 2012
by kmorin@users.forge.codelutin.com Dec. 21, 2012
Dec. 21, 2012
Author: kmorin
Date: 2012-12-21 18:33:19 +0100 (Fri, 21 Dec 2012)
New Revision: 103
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/103
Log:
refs #1812
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-21 17:30:56 UTC (rev 102)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-21 17:33:19 UTC (rev 103)
@@ -25,11 +25,9 @@
*/
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -42,6 +40,8 @@
import fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology.HydrologyTabUI;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology.HydrologyTabUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListSelectionEvent;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -53,7 +53,9 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;
-import java.util.Map;
+import javax.swing.event.ListDataListener;
+import javax.swing.event.ListSelectionListener;
+import jaxx.runtime.swing.editor.bean.BeanDoubleListModel;
/**
@@ -105,7 +107,10 @@
EditFishingOperationUIModel.PROPERTY_FISHING_OPERATION_VALID,
EditFishingOperationUIModel.PROPERTY_LOCATION,
EditFishingOperationUIModel.PROPERTY_COMMENT,
- EditFishingOperationUIModel.PROPERTY_SAISISSEUR);
+ EditFishingOperationUIModel.PROPERTY_SAISISSEUR,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_CARACTERISTICS,
+ EditFishingOperationUIModel.PROPERTY_ENVIRONMENT_CARACTERISTICS,
+ EditFishingOperationUIModel.PROPERTY_HYDROLOGY_CARACTERISTICS);
}
@Override
@@ -168,7 +173,25 @@
initBeanList(ui.getSaisisseurList(),
persistenceService.getAllPerson(),
model.getSaisisseur());
+ final BeanDoubleListModel<Person> saisisseurModel = ui.getSaisisseurList().getModel();
+ saisisseurModel.getSelectedModel().addListDataListener(new ListDataListener() {
+ public void intervalAdded(ListDataEvent e) {
+ log.info(">>>>>>>>>> intervalAdded " + saisisseurModel.getSelected());
+ ui.getModel().setSaisisseur(saisisseurModel.getSelected());
+ }
+
+ public void intervalRemoved(ListDataEvent e) {
+ log.info(">>>>>>>>>> intervalRemoved " + saisisseurModel.getSelected());
+ ui.getModel().setSaisisseur(saisisseurModel.getSelected());
+ }
+
+ public void contentsChanged(ListDataEvent e) {
+ log.info(">>>>>>>>>> contentsChanged " + saisisseurModel.getSelected());
+ ui.getModel().setSaisisseur(saisisseurModel.getSelected());
+ }
+ });
+
String programId = context.getProgramId();
Program program = persistenceService.getProgram(programId);
@@ -225,12 +248,11 @@
new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
- model.setModify(true);
model.setGearShootingCaracteristics((CaracteristicMap) evt.getNewValue());
}
}
);
- CaracteristicMap gearShootingCaracteristics = getDefaultGearShootingCaracteristics();
+ CaracteristicMap gearShootingCaracteristics = model.getGearShootingCaracteristics();
ui.getModel().setGearShootingCaracteristics(gearShootingCaracteristics);
gearShootingModel.setGearShootingCaracteristics(gearShootingCaracteristics);
@@ -243,12 +265,11 @@
new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
- model.setModify(true);
model.setEnvironmentCaracteristics((CaracteristicMap) evt.getNewValue());
}
}
);
- CaracteristicMap environmentCaracteristics = ui.getModel().getEnvironmentCaracteristics();
+ CaracteristicMap environmentCaracteristics = model.getEnvironmentCaracteristics();
ui.getModel().setEnvironmentCaracteristics(environmentCaracteristics);
environmentModel.setEnvironmentCaracteristics(environmentCaracteristics);
@@ -265,89 +286,11 @@
}
}
);
- CaracteristicMap hydrologyCaracteristics = getDefaultHydrologyCaracteristics();
+ CaracteristicMap hydrologyCaracteristics = model.getHydrologyCaracteristics();
ui.getModel().setHydrologyCaracteristics(hydrologyCaracteristics);
hydrologyModel.setHydrologyCaracteristics(hydrologyCaracteristics);
}
- protected CaracteristicMap getDefaultGearShootingCaracteristics() {
- CaracteristicMap gearShootingCaracteristics = new CaracteristicMap();
-// gearShootingParams.put(
-// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_START_DEPTH)),
-// null
-// );
-// gearShootingParams.put(
-// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_END_DEPTH)),
-// null
-// );
-// gearShootingParams.put(
-// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_HORIZONTAL_APERTURE)),
-// null
-// );
-// gearShootingParams.put(
-// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_VERTICAL_APERTURE)),
-// null
-// );
-// gearShootingParams.put(
-// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_WARP_LENGTH)),
-// null
-// );
-// gearShootingParams.put(
-// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_ARM_LENGTH)),
-// null
-// );
-// gearShootingParams.put(
-// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_SYSTEME_FERMETURE_CUL)),
-// null
-// );
-// gearShootingParams.put(
-// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_MEASURED_GEOMETRY)),
-// null
-// );
-
- return gearShootingCaracteristics;
- }
-
- protected CaracteristicMap getDefaultEnvironmentCaracteristics() {
- CaracteristicMap environmentCaracteristics = new CaracteristicMap();
- List<Caracteristic> availableCaracteristics = ui.getEnvironmentTabContent().getModel().getAvailableCaracteristics();
-// environmentCaracteristics.put(availableCaracteristics.get(0), );
-// environmentCaracteristics.put(
-// _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_BEAUFORT_SCALE)),
-// null
-// );
-// environmentCaracteristics.put(
-// _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_WIND_DIRECTION)),
-// null
-// );
-// environmentCaracteristics.put(
-// _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_SEA_STATE)),
-// null
-// );
- return environmentCaracteristics;
- }
-
- protected CaracteristicMap getDefaultHydrologyCaracteristics() {
- CaracteristicMap hydrologyCaracteristics = new CaracteristicMap();
-// hydrologyCaracteristics.put(
-// _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.TEMPERATURE + "." + HydrologyTabUIModel.SURFACE)),
-// null
-// );
-// hydrologyCaracteristics.put(
-// _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.TEMPERATURE + "." + HydrologyTabUIModel.BOTTOM)),
-// null
-// );
-// hydrologyCaracteristics.put(
-// _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.SALINITY + "." + HydrologyTabUIModel.SURFACE)),
-// null
-// );
-// hydrologyCaracteristics.put(
-// _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.SALINITY + "." + HydrologyTabUIModel.BOTTOM)),
-// null
-// );
- return hydrologyCaracteristics;
- }
-
@Override
public void onCloseUI() {
}
@@ -358,7 +301,7 @@
}
public void selectFishingOperation(FishingOperation bean) {
-
+
if (fishingOperationMonitor.wasModified()) {
// previous fishingOperation was modified, let's save it
@@ -380,7 +323,8 @@
" was modified, will save it.");
}
- persistenceService.saveFishingOperation(toSave);
+ // persist current fishingOperation
+ parentUi.getHandler().saveFishingOperation(toSave, false);
}
}
@@ -427,17 +371,17 @@
//reset gear shooting
GearShootingTabUI gearShootingTab = ui.getGearShootingTabContent();
- gearShootingTab.getModel().setGearShootingCaracteristics(getDefaultGearShootingCaracteristics());
+ gearShootingTab.getModel().setGearShootingCaracteristics(model.getGearShootingCaracteristics());
gearShootingTab.getHandler().reset();
//reset environment
EnvironmentTabUI environmentTab = ui.getEnvironmentTabContent();
- environmentTab.getModel().setEnvironmentCaracteristics(getDefaultEnvironmentCaracteristics());
+ environmentTab.getModel().setEnvironmentCaracteristics(model.getEnvironmentCaracteristics());
environmentTab.getHandler().reset();
//reset hydrology
HydrologyTabUI hydrologyTab = ui.getHydrologyTabContent();
- hydrologyTab.getModel().setHydrologyCaracteristics(getDefaultHydrologyCaracteristics());
+ hydrologyTab.getModel().setHydrologyCaracteristics(model.getHydrologyCaracteristics());
hydrologyTab.getHandler().reset();
fishingOperationMonitor.clearModified();
@@ -488,14 +432,6 @@
ui.getFishingOperationTabPane().setSelectedIndex(selectedIndex);
// getModel().setModify(false);
-
- for (Object key : ui.getModel().getEnvironmentCaracteristics().keySet()) {
- log.info(key + " : " + ui.getModel().getEnvironmentCaracteristics().get(key));
- }
-
- for (Object key : ui.getModel().getHydrologyCaracteristics().keySet()) {
- log.info(key + " : " + ui.getModel().getHydrologyCaracteristics().get(key));
- }
}
public void importCasino() {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java 2012-12-21 17:30:56 UTC (rev 102)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java 2012-12-21 17:33:19 UTC (rev 103)
@@ -55,15 +55,20 @@
protected Caracteristic key;
- protected String value;
+ protected Object value;
public EnvironmentRowModel() {
super(CaracteristicRow.class, fromBeanBinder, toBeanBinder);
}
public EnvironmentRowModel(Caracteristic key) {
+ this(key, null);
+ }
+
+ public EnvironmentRowModel(Caracteristic key, Object value) {
this();
this.key = key;
+ this.value = value;
}
public Caracteristic getKey() {
@@ -76,11 +81,11 @@
firePropertyChange(PROPERTY_KEY, oldValue, key);
}
- public String getValue() {
+ public Object getValue() {
return value;
}
- public void setValue(String value) {
+ public void setValue(Object value) {
Object oldValue = getValue();
this.value = value;
firePropertyChange(PROPERTY_VALUE, oldValue, value);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java 2012-12-21 17:30:56 UTC (rev 102)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java 2012-12-21 17:33:19 UTC (rev 103)
@@ -35,14 +35,12 @@
import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableColumnModel;
-import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
@@ -195,15 +193,18 @@
*/
public void reset() {
CaracteristicMap environmentCaracteristics = ui.getModel().getEnvironmentCaracteristics();
+ if (environmentCaracteristics == null) {
+ environmentCaracteristics = new CaracteristicMap();
+ }
List<EnvironmentRowModel> rows = Lists.newArrayList();
Collection<Caracteristic> caracteristics = environmentCaracteristics.keySet();
for (Caracteristic key : environmentCaracteristics.keySet()) {
- rows.add(new EnvironmentRowModel(key));
+ rows.add(new EnvironmentRowModel(key, environmentCaracteristics.get(key)));
}
AbstractTuttiTableModel<EnvironmentRowModel> tableModel = getTableModel();
- tableModel.setRows(rows);
+ tableModel.setRows(rows, false);
JComboBox keyCombo = ui.getNewRowKey();
DefaultComboBoxModel keyComboModel = (DefaultComboBoxModel) keyCombo.getModel();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java 2012-12-21 17:30:56 UTC (rev 102)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java 2012-12-21 17:33:19 UTC (rev 103)
@@ -44,7 +44,7 @@
*/
public class EnvironmentTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, EnvironmentRowModel, EnvironmentTabUIModel> {
- protected CaracteristicMap environmentCaracteristics;
+ protected CaracteristicMap environmentCaracteristics = new CaracteristicMap();
protected List<Caracteristic> availableCaracteristics;
@@ -63,6 +63,9 @@
}
public void setEnvironmentCaracteristics(CaracteristicMap environmentCaracteristics) {
+ if (environmentCaracteristics == null) {
+ environmentCaracteristics = new CaracteristicMap();
+ }
this.environmentCaracteristics = environmentCaracteristics;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTableModel.java 2012-12-21 17:30:56 UTC (rev 102)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTableModel.java 2012-12-21 17:33:19 UTC (rev 103)
@@ -24,10 +24,14 @@
* #L%
*/
+import org.apache.commons.logging.Log;
+import com.google.common.base.Preconditions;
+import java.util.List;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import javax.swing.table.TableColumnModel;
+import org.apache.commons.logging.LogFactory;
import static org.nuiton.i18n.I18n.n_;
/**
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java 2012-12-21 17:30:56 UTC (rev 102)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java 2012-12-21 17:33:19 UTC (rev 103)
@@ -54,15 +54,20 @@
protected Caracteristic key;
- protected String value;
+ protected Object value;
public GearShootingRowModel() {
super(CaracteristicRow.class, fromBeanBinder, toBeanBinder);
}
public GearShootingRowModel(Caracteristic key) {
+ this(key, null);
+ }
+
+ public GearShootingRowModel(Caracteristic key, Object value) {
this();
this.key = key;
+ this.value = value;
}
public Caracteristic getKey() {
@@ -75,11 +80,11 @@
firePropertyChange(PROPERTY_KEY, oldValue, key);
}
- public String getValue() {
+ public Object getValue() {
return value;
}
- public void setValue(String value) {
+ public void setValue(Object value) {
Object oldValue = getValue();
this.value = value;
firePropertyChange(PROPERTY_VALUE, oldValue, value);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java 2012-12-21 17:30:56 UTC (rev 102)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java 2012-12-21 17:33:19 UTC (rev 103)
@@ -79,7 +79,7 @@
{
- addColumnToModel(columnModel, GearShootingTableModel.KEY);
+ addColumnToModel(columnModel, null, newTableCellRender(Caracteristic.class), GearShootingTableModel.KEY);
}
{
@@ -179,12 +179,13 @@
*/
public void addRow() {
JComboBox keyCombo = ui.getNewRowKey();
- Caracteristic key = (Caracteristic) keyCombo.getSelectedItem();
- GearShootingRowModel row = new GearShootingRowModel(key);
+ CaracteristicRow selectedItem = (CaracteristicRow) keyCombo.getSelectedItem();
+ Caracteristic caracteristic = selectedItem.getCaracteristics()[0];
+ GearShootingRowModel row = new GearShootingRowModel(caracteristic);
getTableModel().addNewRow(getTable().getRowCount(), row);
- ui.getModel().setCaracteristic(key, null);
+ ui.getModel().setCaracteristic(caracteristic, null);
- keyCombo.removeItem(key);
+ keyCombo.removeItem(selectedItem);
}
/**
@@ -192,15 +193,18 @@
*/
public void reset() {
CaracteristicMap gearShootingCaracteristics = ui.getModel().getGearShootingCaracteristics();
+ if (gearShootingCaracteristics == null) {
+ gearShootingCaracteristics = new CaracteristicMap();
+ }
List<GearShootingRowModel> rows = Lists.newArrayList();
Collection<Caracteristic> caracteristics = gearShootingCaracteristics.keySet();
for (Caracteristic key : gearShootingCaracteristics.keySet()) {
- rows.add(new GearShootingRowModel(key));
+ rows.add(new GearShootingRowModel(key, gearShootingCaracteristics.get(key)));
}
AbstractTuttiTableModel<GearShootingRowModel> tableModel = getTableModel();
- tableModel.setRows(rows);
+ tableModel.setRows(rows, false);
JComboBox keyCombo = ui.getNewRowKey();
DefaultComboBoxModel keyComboModel = (DefaultComboBoxModel) keyCombo.getModel();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIModel.java 2012-12-21 17:30:56 UTC (rev 102)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIModel.java 2012-12-21 17:33:19 UTC (rev 103)
@@ -42,7 +42,7 @@
*/
public class GearShootingTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, GearShootingRowModel, GearShootingTabUIModel> {
- protected CaracteristicMap gearShootingCaracteristics;
+ protected CaracteristicMap gearShootingCaracteristics = new CaracteristicMap();
protected List<Caracteristic> availableCaracteristics;
@@ -60,8 +60,11 @@
return gearShootingCaracteristics;
}
- public void setGearShootingCaracteristics(CaracteristicMap gearShooting) {
- this.gearShootingCaracteristics = gearShooting;
+ public void setGearShootingCaracteristics(CaracteristicMap gearShootingCaracteristics) {
+ if (gearShootingCaracteristics == null) {
+ gearShootingCaracteristics = new CaracteristicMap();
+ }
+ this.gearShootingCaracteristics = gearShootingCaracteristics;
}
public void setCaracteristic(Caracteristic caracteristic, Object value) {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java 2012-12-21 17:30:56 UTC (rev 102)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java 2012-12-21 17:33:19 UTC (rev 103)
@@ -56,19 +56,27 @@
protected Caracteristic key;
- protected String gearShootingStartValue;
+ protected Object gearShootingStartValue;
- protected String gearShootingEndValue;
+ protected Object gearShootingEndValue;
- protected String averageValue;
+ protected Object averageValue;
public HydrologyRowModel() {
super(CaracteristicRow.class, fromBeanBinder, toBeanBinder);
}
public HydrologyRowModel(Caracteristic key) {
+ this(key, null, null, null);
+ }
+
+ public HydrologyRowModel(Caracteristic key, Object gearShootingStartValue,
+ Object gearShootingEndValue, Object averageValue) {
this();
this.key = key;
+ this.gearShootingStartValue = gearShootingStartValue;
+ this.gearShootingEndValue = gearShootingEndValue;
+ this.averageValue = averageValue;
}
public Caracteristic getKey() {
@@ -81,31 +89,31 @@
firePropertyChange(PROPERTY_KEY, oldValue, key);
}
- public String getGearShootingStartValue() {
+ public Object getGearShootingStartValue() {
return gearShootingStartValue;
}
- public void setGearShootingStartValue(String gearShootingStartValue) {
+ public void setGearShootingStartValue(Object gearShootingStartValue) {
Object oldValue = getGearShootingStartValue();
this.gearShootingStartValue = gearShootingStartValue;
firePropertyChange(PROPERTY_GEAR_SHOOTING_START_VALUE, oldValue, gearShootingStartValue);
}
- public String getGearShootingEndValue() {
+ public Object getGearShootingEndValue() {
return gearShootingEndValue;
}
- public void setGearShootingEndValue(String gearShootingEndValue) {
+ public void setGearShootingEndValue(Object gearShootingEndValue) {
Object oldValue = getGearShootingEndValue();
this.gearShootingEndValue = gearShootingEndValue;
firePropertyChange(PROPERTY_GEAR_SHOOTING_END_VALUE, oldValue, gearShootingEndValue);
}
- public String getAverageValue() {
+ public Object getAverageValue() {
return averageValue;
}
- public void setAverageValue(String averageValue) {
+ public void setAverageValue(Object averageValue) {
Object oldValue = getAverageValue();
this.averageValue = averageValue;
firePropertyChange(PROPERTY_AVERAGE_VALUE, oldValue, averageValue);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java 2012-12-21 17:30:56 UTC (rev 102)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java 2012-12-21 17:33:19 UTC (rev 103)
@@ -83,7 +83,7 @@
{
- addColumnToModel(columnModel, HydrologyTableModel.KEY);
+ addColumnToModel(columnModel, null, newTableCellRender(Caracteristic.class), HydrologyTableModel.KEY);
}
{
@@ -218,7 +218,7 @@
}
AbstractTuttiTableModel<HydrologyRowModel> tableModel = getTableModel();
- tableModel.setRows(rows);
+ tableModel.setRows(rows, false);
JComboBox keyCombo = ui.getNewRowKey();
DefaultComboBoxModel keyComboModel = (DefaultComboBoxModel) keyCombo.getModel();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java 2012-12-21 17:30:56 UTC (rev 102)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java 2012-12-21 17:33:19 UTC (rev 103)
@@ -42,7 +42,7 @@
*/
public class HydrologyTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, HydrologyRowModel, HydrologyTabUIModel> {
- protected CaracteristicMap hydrologyCaracteristics;
+ protected CaracteristicMap hydrologyCaracteristics = new CaracteristicMap();
protected List<Caracteristic> availableCaracteristics;
@@ -61,6 +61,9 @@
}
public void setHydrologyCaracteristics(CaracteristicMap hydrologyCaracteristics) {
+ if (hydrologyCaracteristics == null) {
+ hydrologyCaracteristics = new CaracteristicMap();
+ }
this.hydrologyCaracteristics = hydrologyCaracteristics;
}
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-21 17:30:56 UTC (rev 102)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java 2012-12-21 17:33:19 UTC (rev 103)
@@ -97,11 +97,15 @@
}
public final void setRows(List<R> data) {
+ setRows(data, true);
+ }
+
+ public final void setRows(List<R> data, boolean checkEmpty) {
// can't accept a empty data list
Preconditions.checkNotNull(data, "Data list can not be null.");
- if (data.isEmpty()) {
+ if (checkEmpty && data.isEmpty()) {
// add a first edit line
data.add(createNewRow());
1
0
Dec. 21, 2012
Author: kmorin
Date: 2012-12-21 18:30:56 +0100 (Fri, 21 Dec 2012)
New Revision: 102
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/102
Log:
renommage d'attributs
Modified:
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
1
0
Dec. 21, 2012
Author: kmorin
Date: 2012-12-21 11:51:41 +0100 (Fri, 21 Dec 2012)
New Revision: 101
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/101
Log:
renommage d'attributs
Modified:
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
1
0
r100 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation: . catches
by tchemit@users.forge.codelutin.com Dec. 20, 2012
by tchemit@users.forge.codelutin.com Dec. 20, 2012
Dec. 20, 2012
Author: tchemit
Date: 2012-12-20 18:28:55 +0100 (Thu, 20 Dec 2012)
New Revision: 100
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/100
Log:
sauvegarde automatique du trait
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2012-12-20 17:05:25 UTC (rev 99)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2012-12-20 17:28:55 UTC (rev 100)
@@ -249,7 +249,7 @@
}
#createFishingOperationActions {
- visible: {model.isEmpty()};
+ visible: {!model.isPersisted()};
}
#saveButton {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-20 17:05:25 UTC (rev 99)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-20 17:28:55 UTC (rev 100)
@@ -380,7 +380,7 @@
" was modified, will save it.");
}
- parentUi.getHandler().saveFishingOperation(toSave);
+ persistenceService.saveFishingOperation(toSave);
}
}
@@ -425,9 +425,6 @@
// update model empty property
model.setEmpty(empty);
- // if new fishingOperation can already cancel his creation
- model.setModify(!empty && model.isCreate());
-
//reset gear shooting
GearShootingTabUI gearShootingTab = ui.getGearShootingTabContent();
gearShootingTab.getModel().setGearShootingCaracteristics(getDefaultGearShootingCaracteristics());
@@ -481,6 +478,9 @@
// keep selected tab (to resotre it after save)
int selectedIndex = ui.getFishingOperationTabPane().getSelectedIndex();
+ // clean auto-save monitor to avoid re-entrant code
+ fishingOperationMonitor.clearModified();
+
// persist current fishingOperation
parentUi.getHandler().saveFishingOperation(toSave);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-20 17:05:25 UTC (rev 99)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-20 17:28:55 UTC (rev 100)
@@ -25,19 +25,18 @@
*/
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import fr.ird.type.SexagecimalPosition;
-import java.util.Collection;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
import java.util.Date;
import java.util.List;
-import java.util.Map;
/**
* Model for UI {@link EditFishingOperationUI}.
@@ -49,6 +48,8 @@
private static final long serialVersionUID = 1L;
+ public static final String PROPERTY_PERSISTED = "persisted";
+
public static final String PROPERTY_EMPTY = "empty";
public static final String PROPERTY_STATION_NUMBER = "stationNumber";
@@ -93,6 +94,11 @@
public static final String PROPERTY_HYDROLOGY_CARACTERISTICS = "hydrologyCaracteristics";
+ /**
+ * Flag when there is no fishing operation selected.
+ *
+ * @since 0.2
+ */
protected boolean empty;
protected Cruise cruise;
@@ -152,7 +158,7 @@
protected CaracteristicMap environmentCaracteristics;
protected CaracteristicMap hydrologyCaracteristics;
-
+
protected FishingOperation fishingOperation;
protected static Binder<EditFishingOperationUIModel, FishingOperation> toBeanBinder =
@@ -172,8 +178,13 @@
public void setFishingOperation(FishingOperation fishingOperation) {
this.fishingOperation = fishingOperation;
+ firePropertyChange(PROPERTY_PERSISTED, null, isPersisted());
}
+ public boolean isPersisted() {
+ return fishingOperation != null && !TuttiEntities.isNew(fishingOperation);
+ }
+
public boolean isEmpty() {
return empty;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-20 17:05:25 UTC (rev 99)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-20 17:28:55 UTC (rev 100)
@@ -36,8 +36,6 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.decorator.Decorator;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Date;
@@ -178,12 +176,6 @@
// back to general tab of fishingOperation tabs
ui.getFishingOperationTabContent().getFishingOperationTabPane().setSelectedIndex(0);
- ui.getTabPane().addChangeListener(new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent e) {
- }
- });
-
String fishingOperationText;
if (fishingOperation == null) {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2012-12-20 17:05:25 UTC (rev 99)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2012-12-20 17:28:55 UTC (rev 100)
@@ -90,136 +90,132 @@
<tab id='catchesCaracteristicsTab'
title='tutti.label.tab.catchesCaracteristics'>
<JXTitledPanel id='catchesTabsFishingOperationReminderLabel'>
- <Table id="catchesForm" fill='both' weightx='1'>
- <row>
- <cell>
- <Table id='speciesTable' fill='both'>
+ <JPanel layout='{new BorderLayout()}'>
+ <Table id="catchesForm" fill='both' weightx='1'
+ constraints='BorderLayout.NORTH'>
+ <row>
+ <cell columns="2">
+ <Table id='speciesTable' fill='both'>
- <!-- Poids total / Poids total vrac -->
- <row>
- <cell anchor='west'>
- <JLabel id='speciesTotalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='speciesTotalWeightField'
- constructorParams='this'/>
- </cell>
- <cell anchor='west'>
- <JLabel id='speciesTotalSortedWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='speciesTotalSortedWeightField'
- constructorParams='this'/>
- </cell>
- </row>
+ <!-- Poids total / Poids total vrac -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='speciesTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='speciesTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='speciesTotalSortedWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='speciesTotalSortedWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
- <!-- Poids échantillonné vrac / Poids total hors vrac -->
- <row>
- <cell>
- <JLabel id='speciesSampleSortedWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='speciesSampleSortedWeightField'
- constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='speciesTotalUnsortedWeightLabel'/>
- </cell>
- <cell>
- <JTextField id='speciesTotalUnsortedWeightField'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell>
- <Table id='benthosTable' fill='both'>
+ <!-- Poids échantillonné vrac / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='speciesSampleSortedWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='speciesSampleSortedWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='speciesTotalUnsortedWeightLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='speciesTotalUnsortedWeightField'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell weightx="0.5">
+ <Table id='benthosTable' fill='both'>
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='benthosTotalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='benthosTotalWeightField'
- constructorParams='this'/>
- </cell>
- </row>
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='benthosTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='benthosTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='benthosSampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='benthosSampleTotalWeightField'
- constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell>
- <Table id='planktonTable' fill='both'>
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='benthosSampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='benthosSampleTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell weightx="0.5">
+ <Table id='planktonTable' fill='both'>
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='planktonTotalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='planktonTotalWeightField'
- constructorParams='this'/>
- </cell>
- </row>
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='planktonTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='planktonTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='planktonSampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='planktonSampleTotalWeightField'
- constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell>
- <Table id='macroWasteTable' fill='both'>
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='planktonSampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='planktonSampleTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell columns="2">
+ <Table id='macroWasteTable' fill='both'>
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='macroWasteTotalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='macroWasteTotalWeightField'
- constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell>
-
- </cell>
- </row>
- <!-- Actions d'import -->
- <row>
- <cell columns='6'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton id='importPupitriButton'
- onActionPerformed='handler.importPupitri()'/>
- </JPanel>
- </cell>
- </row>
- </Table>
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='macroWasteTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='macroWasteTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <!-- Actions d'import -->
+ <row>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='importPupitriButton'
+ onActionPerformed='handler.importPupitri()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
</JXTitledPanel>
</tab>
<tab id='speciesTab' title='tutti.label.tab.species'>
@@ -244,7 +240,7 @@
</tab>
<tab id='accidentalTab' title='tutti.label.tab.accidentel'>
<JXTitledPanel id='accidentalTabFishingOperationReminderLabel'>
- <AccidentalBatchUI id='accidentalTabContent' constructorParams='this'/>
+ <AccidentalBatchUI id='accidentalTabContent' constructorParams='this'/>
</JXTitledPanel>
</tab>
<tab id='observationIndividuelTab'
1
0
r99 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing: content/operation content/operation/fishing/environment content/operation/fishing/gearshooting content/operation/fishing/hydrology util/table
by kmorin@users.forge.codelutin.com Dec. 20, 2012
by kmorin@users.forge.codelutin.com Dec. 20, 2012
Dec. 20, 2012
Author: kmorin
Date: 2012-12-20 18:05:25 +0100 (Thu, 20 Dec 2012)
New Revision: 99
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/99
Log:
refs #1812
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/CaracteristicRow.java
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-20 16:08:26 UTC (rev 98)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-20 17:05:25 UTC (rev 99)
@@ -26,8 +26,10 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -53,7 +55,6 @@
import java.util.List;
import java.util.Map;
-import static org.nuiton.i18n.I18n._;
/**
* Handler for UI {@link EditFishingOperationUI}.
@@ -218,42 +219,45 @@
//init gear shooting
GearShootingTabUIModel gearShootingModel =
ui.getGearShootingTabContent().getModel();
+ gearShootingModel.setAvailableCaracteristics(persistenceService.getAllFishingOperationGearCaracteristic());
gearShootingModel.addPropertyChangeListener(
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_PARAMETERS,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_CARACTERISTICS,
new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
model.setModify(true);
- model.setGearShootingParameters((Map<Object, Object>) evt.getNewValue());
+ model.setGearShootingCaracteristics((CaracteristicMap) evt.getNewValue());
}
}
);
- Map<Object, Object> gearShootingParams = getDefaultGearShootingParams();
- ui.getModel().setGearShootingParameters(gearShootingParams);
- gearShootingModel.setGearShootingParameters(gearShootingParams);
+ CaracteristicMap gearShootingCaracteristics = getDefaultGearShootingCaracteristics();
+ ui.getModel().setGearShootingCaracteristics(gearShootingCaracteristics);
+ gearShootingModel.setGearShootingCaracteristics(gearShootingCaracteristics);
//init environment
EnvironmentTabUIModel environmentModel =
ui.getEnvironmentTabContent().getModel();
+ environmentModel.setAvailableCaracteristics(persistenceService.getAllFishingOperationEnvironmentCaracteristic());
environmentModel.addPropertyChangeListener(
- EditFishingOperationUIModel.PROPERTY_ENVIRONMENT_PARAMETERS,
+ EditFishingOperationUIModel.PROPERTY_ENVIRONMENT_CARACTERISTICS,
new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
model.setModify(true);
- model.setEnvironmentParameters((Map<Object, Object>) evt.getNewValue());
+ model.setEnvironmentCaracteristics((CaracteristicMap) evt.getNewValue());
}
}
);
- Map<Object, Object> environmentParams = getDefaultEnvironmentParams();
- ui.getModel().setEnvironmentParameters(environmentParams);
- environmentModel.setEnvironmentParameters(environmentParams);
+ CaracteristicMap environmentCaracteristics = ui.getModel().getEnvironmentCaracteristics();
+ ui.getModel().setEnvironmentCaracteristics(environmentCaracteristics);
+ environmentModel.setEnvironmentCaracteristics(environmentCaracteristics);
//init hydrology
HydrologyTabUIModel hydrologyModel =
ui.getHydrologyTabContent().getModel();
+ hydrologyModel.setAvailableCaracteristics(persistenceService.getAllFishingOperationHydrologicCaracteristic());
hydrologyModel.addPropertyChangeListener(
- EditFishingOperationUIModel.PROPERTY_HYDROLOGY_PARAMETERS,
+ EditFishingOperationUIModel.PROPERTY_HYDROLOGY_CARACTERISTICS,
new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
@@ -261,85 +265,87 @@
}
}
);
- Map<Object, Object> hydrologyParams = getDefaultHydrologyParams();
- ui.getModel().setHydrologyParameters(hydrologyParams);
- hydrologyModel.setHydrologyParameters(getDefaultHydrologyParams());
+ CaracteristicMap hydrologyCaracteristics = getDefaultHydrologyCaracteristics();
+ ui.getModel().setHydrologyCaracteristics(hydrologyCaracteristics);
+ hydrologyModel.setHydrologyCaracteristics(hydrologyCaracteristics);
}
- protected Map<Object, Object> getDefaultGearShootingParams() {
- Map<Object, Object> gearShootingParams = Maps.newLinkedHashMap();
- gearShootingParams.put(
- _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_START_DEPTH)),
- null
- );
- gearShootingParams.put(
- _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_END_DEPTH)),
- null
- );
- gearShootingParams.put(
- _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_HORIZONTAL_APERTURE)),
- null
- );
- gearShootingParams.put(
- _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_VERTICAL_APERTURE)),
- null
- );
- gearShootingParams.put(
- _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_WARP_LENGTH)),
- null
- );
- gearShootingParams.put(
- _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_ARM_LENGTH)),
- null
- );
- gearShootingParams.put(
- _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_SYSTEME_FERMETURE_CUL)),
- null
- );
- gearShootingParams.put(
- _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_MEASURED_GEOMETRY)),
- null
- );
+ protected CaracteristicMap getDefaultGearShootingCaracteristics() {
+ CaracteristicMap gearShootingCaracteristics = new CaracteristicMap();
+// gearShootingParams.put(
+// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_START_DEPTH)),
+// null
+// );
+// gearShootingParams.put(
+// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_END_DEPTH)),
+// null
+// );
+// gearShootingParams.put(
+// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_HORIZONTAL_APERTURE)),
+// null
+// );
+// gearShootingParams.put(
+// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_VERTICAL_APERTURE)),
+// null
+// );
+// gearShootingParams.put(
+// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_WARP_LENGTH)),
+// null
+// );
+// gearShootingParams.put(
+// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_ARM_LENGTH)),
+// null
+// );
+// gearShootingParams.put(
+// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_SYSTEME_FERMETURE_CUL)),
+// null
+// );
+// gearShootingParams.put(
+// _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_MEASURED_GEOMETRY)),
+// null
+// );
- return gearShootingParams;
+ return gearShootingCaracteristics;
}
- protected Map<Object, Object> getDefaultEnvironmentParams() {
- Map<Object, Object> environmentParams = Maps.newLinkedHashMap();
- environmentParams.put(
- _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_BEAUFORT_SCALE)),
- null
- );
- environmentParams.put(
- _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_WIND_DIRECTION)),
- null
- );
- environmentParams.put(
- _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_SEA_STATE)),
- null
- );
- return environmentParams;
+ protected CaracteristicMap getDefaultEnvironmentCaracteristics() {
+ CaracteristicMap environmentCaracteristics = new CaracteristicMap();
+ List<Caracteristic> availableCaracteristics = ui.getEnvironmentTabContent().getModel().getAvailableCaracteristics();
+// environmentCaracteristics.put(availableCaracteristics.get(0), );
+// environmentCaracteristics.put(
+// _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_BEAUFORT_SCALE)),
+// null
+// );
+// environmentCaracteristics.put(
+// _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_WIND_DIRECTION)),
+// null
+// );
+// environmentCaracteristics.put(
+// _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_SEA_STATE)),
+// null
+// );
+ return environmentCaracteristics;
}
- protected Map<Object, Object> getDefaultHydrologyParams() {
- Map<Object, Object> hydrologyParams = Maps.newLinkedHashMap();
- hydrologyParams.put(
- _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.TEMPERATURE + "." + HydrologyTabUIModel.SURFACE)),
- null
- );
- hydrologyParams.put(
- _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.TEMPERATURE + "." + HydrologyTabUIModel.BOTTOM)),
- null
- );
- hydrologyParams.put(
- _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.SALINITY + "." + HydrologyTabUIModel.SURFACE)),
- null
- );
- hydrologyParams.put(
- _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.SALINITY + "." + HydrologyTabUIModel.BOTTOM)),
- null
- );
- return hydrologyParams;
+ protected CaracteristicMap getDefaultHydrologyCaracteristics() {
+ CaracteristicMap hydrologyCaracteristics = new CaracteristicMap();
+// hydrologyCaracteristics.put(
+// _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.TEMPERATURE + "." + HydrologyTabUIModel.SURFACE)),
+// null
+// );
+// hydrologyCaracteristics.put(
+// _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.TEMPERATURE + "." + HydrologyTabUIModel.BOTTOM)),
+// null
+// );
+// hydrologyCaracteristics.put(
+// _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.SALINITY + "." + HydrologyTabUIModel.SURFACE)),
+// null
+// );
+// hydrologyCaracteristics.put(
+// _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.SALINITY + "." + HydrologyTabUIModel.BOTTOM)),
+// null
+// );
+ return hydrologyCaracteristics;
}
@Override
@@ -424,17 +430,17 @@
//reset gear shooting
GearShootingTabUI gearShootingTab = ui.getGearShootingTabContent();
- gearShootingTab.getModel().setGearShootingParameters(getDefaultGearShootingParams());
+ gearShootingTab.getModel().setGearShootingCaracteristics(getDefaultGearShootingCaracteristics());
gearShootingTab.getHandler().reset();
//reset environment
EnvironmentTabUI environmentTab = ui.getEnvironmentTabContent();
- environmentTab.getModel().setEnvironmentParameters(getDefaultEnvironmentParams());
+ environmentTab.getModel().setEnvironmentCaracteristics(getDefaultEnvironmentCaracteristics());
environmentTab.getHandler().reset();
//reset hydrology
HydrologyTabUI hydrologyTab = ui.getHydrologyTabContent();
- hydrologyTab.getModel().setHydrologyParameters(getDefaultHydrologyParams());
+ hydrologyTab.getModel().setHydrologyCaracteristics(getDefaultHydrologyCaracteristics());
hydrologyTab.getHandler().reset();
fishingOperationMonitor.clearModified();
@@ -483,12 +489,12 @@
// getModel().setModify(false);
- for (Object key : ui.getModel().getEnvironmentParameters().keySet()) {
- log.info(key + " : " + ui.getModel().getEnvironmentParameters().get(key));
+ for (Object key : ui.getModel().getEnvironmentCaracteristics().keySet()) {
+ log.info(key + " : " + ui.getModel().getEnvironmentCaracteristics().get(key));
}
- for (Object key : ui.getModel().getHydrologyParameters().keySet()) {
- log.info(key + " : " + ui.getModel().getHydrologyParameters().get(key));
+ for (Object key : ui.getModel().getHydrologyCaracteristics().keySet()) {
+ log.info(key + " : " + ui.getModel().getHydrologyCaracteristics().get(key));
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-20 16:08:26 UTC (rev 98)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-20 17:05:25 UTC (rev 99)
@@ -24,12 +24,14 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import fr.ird.type.SexagecimalPosition;
+import java.util.Collection;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -85,11 +87,11 @@
public static final String PROPERTY_SAISISSEUR = "saisisseur";
- public static final String PROPERTY_GEAR_SHOOTING_PARAMETERS = "gearShootingParameters";
+ public static final String PROPERTY_GEAR_SHOOTING_CARACTERISTICS = "gearShootingCaracteristics";
- public static final String PROPERTY_ENVIRONMENT_PARAMETERS = "environmentParameters";
+ public static final String PROPERTY_ENVIRONMENT_CARACTERISTICS = "environmentCaracteristics";
- public static final String PROPERTY_HYDROLOGY_PARAMETERS = "hydrologyParameters";
+ public static final String PROPERTY_HYDROLOGY_CARACTERISTICS = "hydrologyCaracteristics";
protected boolean empty;
@@ -145,14 +147,14 @@
protected List<Person> saisisseur;
- protected Map<Object, Object> gearShootingParameters;
+ protected CaracteristicMap gearShootingCaracteristics;
- protected Map<Object, Object> environmentParameters;
+ protected CaracteristicMap environmentCaracteristics;
+ protected CaracteristicMap hydrologyCaracteristics;
+
protected FishingOperation fishingOperation;
- protected Map<Object, Object> hydrologyParameters;
-
protected static Binder<EditFishingOperationUIModel, FishingOperation> toBeanBinder =
BinderFactory.newBinder(EditFishingOperationUIModel.class,
FishingOperation.class);
@@ -374,33 +376,33 @@
return fishingOperation;
}
- public Map<Object, Object> getGearShootingParameters() {
- return gearShootingParameters;
+ public CaracteristicMap getGearShootingCaracteristics() {
+ return gearShootingCaracteristics;
}
- public void setGearShootingParameters(Map<Object, Object> gearShootingParameters) {
- Object oldValue = getGearShootingParameters();
- this.gearShootingParameters = gearShootingParameters;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_PARAMETERS, oldValue, gearShootingParameters);
+ public void setGearShootingCaracteristics(CaracteristicMap gearShootingParameters) {
+ Object oldValue = getGearShootingCaracteristics();
+ this.gearShootingCaracteristics = gearShootingParameters;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_CARACTERISTICS, oldValue, gearShootingParameters);
}
- public Map<Object, Object> getEnvironmentParameters() {
- return environmentParameters;
+ public CaracteristicMap getEnvironmentCaracteristics() {
+ return environmentCaracteristics;
}
- public void setEnvironmentParameters(Map<Object, Object> environmentParameters) {
- Object oldValue = getEnvironmentParameters();
- this.environmentParameters = environmentParameters;
- firePropertyChange(PROPERTY_ENVIRONMENT_PARAMETERS, oldValue, environmentParameters);
+ public void setEnvironmentCaracteristics(CaracteristicMap environmentParameters) {
+ Object oldValue = getEnvironmentCaracteristics();
+ this.environmentCaracteristics = environmentParameters;
+ firePropertyChange(PROPERTY_ENVIRONMENT_CARACTERISTICS, oldValue, environmentParameters);
}
- public Map<Object, Object> getHydrologyParameters() {
- return hydrologyParameters;
+ public CaracteristicMap getHydrologyCaracteristics() {
+ return hydrologyCaracteristics;
}
- public void setHydrologyParameters(Map<Object, Object> hydrologyParameters) {
- Object oldValue = getHydrologyParameters();
- this.hydrologyParameters = hydrologyParameters;
- firePropertyChange(PROPERTY_HYDROLOGY_PARAMETERS, oldValue, hydrologyParameters);
+ public void setHydrologyCaracteristics(CaracteristicMap hydrologyParameters) {
+ Object oldValue = getHydrologyCaracteristics();
+ this.hydrologyCaracteristics = hydrologyParameters;
+ firePropertyChange(PROPERTY_HYDROLOGY_CARACTERISTICS, oldValue, hydrologyParameters);
}
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java 2012-12-20 16:08:26 UTC (rev 98)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java 2012-12-20 17:05:25 UTC (rev 99)
@@ -24,7 +24,10 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import fr.ifremer.tutti.ui.swing.util.table.CaracteristicRow;
+import java.util.Map.Entry;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.beans.Binder;
@@ -35,39 +38,39 @@
* @author kmorin
* @since 0.3
*/
-public class EnvironmentRowModel extends AbstractTuttiBeanUIModel<Object, EnvironmentRowModel> {
+public class EnvironmentRowModel extends AbstractTuttiBeanUIModel<CaracteristicRow, EnvironmentRowModel> {
private static final Log log = LogFactory.getLog(EnvironmentRowModel.class);
public static final String PROPERTY_KEY = "key";
public static final String PROPERTY_VALUE = "value";
- protected static final Binder<Object, EnvironmentRowModel> fromBeanBinder =
- BinderFactory.newBinder(Object.class,
+ protected static final Binder<CaracteristicRow, EnvironmentRowModel> fromBeanBinder =
+ BinderFactory.newBinder(CaracteristicRow.class,
EnvironmentRowModel.class);
- protected static final Binder<EnvironmentRowModel, Object> toBeanBinder =
+ protected static final Binder<EnvironmentRowModel, CaracteristicRow> toBeanBinder =
BinderFactory.newBinder(EnvironmentRowModel.class,
- Object.class);
+ CaracteristicRow.class);
- protected String key;
+ protected Caracteristic key;
protected String value;
public EnvironmentRowModel() {
- super(Object.class, fromBeanBinder, toBeanBinder);
+ super(CaracteristicRow.class, fromBeanBinder, toBeanBinder);
}
- public EnvironmentRowModel(String key) {
+ public EnvironmentRowModel(Caracteristic key) {
this();
this.key = key;
}
- public String getKey() {
+ public Caracteristic getKey() {
return key;
}
- public void setKey(String key) {
+ public void setKey(Caracteristic key) {
Object oldValue = getKey();
this.key = key;
firePropertyChange(PROPERTY_KEY, oldValue, key);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java 2012-12-20 16:08:26 UTC (rev 98)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java 2012-12-20 17:05:25 UTC (rev 99)
@@ -25,10 +25,13 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.tutti.ui.swing.util.table.CaracteristicRow;
import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
import java.util.Collection;
import java.util.List;
@@ -39,6 +42,7 @@
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableColumnModel;
+import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
@@ -77,7 +81,7 @@
{
- addColumnToModel(columnModel, EnvironmentTableModel.KEY);
+ addColumnToModel(columnModel, null, newTableCellRender(Caracteristic.class), EnvironmentTableModel.KEY);
}
{
@@ -155,7 +159,7 @@
TuttiBeanMonitor<EnvironmentRowModel> monitor = getRowMonitor();
EnvironmentRowModel row = monitor.getBean();
if (row != null) {
- ui.getModel().setParameter(row.getKey(), row.getValue());
+ ui.getModel().setCaracteristic(row.getKey(), row.getValue());
}
}
};
@@ -177,24 +181,25 @@
*/
public void addRow() {
JComboBox keyCombo = ui.getNewRowKey();
- String key = (String) keyCombo.getSelectedItem();
- EnvironmentRowModel row = new EnvironmentRowModel(key);
+ CaracteristicRow selectedItem = (CaracteristicRow) keyCombo.getSelectedItem();
+ Caracteristic caracteristic = selectedItem.getCaracteristics()[0];
+ EnvironmentRowModel row = new EnvironmentRowModel(caracteristic);
getTableModel().addNewRow(getTable().getRowCount(), row);
- ui.getModel().setParameter(key, null);
+ ui.getModel().setCaracteristic(caracteristic, null);
- keyCombo.removeItem(key);
+ keyCombo.removeItem(selectedItem);
}
/**
* Resets the table with the data from the database
*/
public void reset() {
- Map<Object, Object> environmentParameters = ui.getModel().getEnvironmentParameters();
+ CaracteristicMap environmentCaracteristics = ui.getModel().getEnvironmentCaracteristics();
List<EnvironmentRowModel> rows = Lists.newArrayList();
- Collection<Object> params = environmentParameters.keySet();
- for (Object key : environmentParameters.keySet()) {
- rows.add(new EnvironmentRowModel(key.toString()));
+ Collection<Caracteristic> caracteristics = environmentCaracteristics.keySet();
+ for (Caracteristic key : environmentCaracteristics.keySet()) {
+ rows.add(new EnvironmentRowModel(key));
}
AbstractTuttiTableModel<EnvironmentRowModel> tableModel = getTableModel();
@@ -203,9 +208,13 @@
JComboBox keyCombo = ui.getNewRowKey();
DefaultComboBoxModel keyComboModel = (DefaultComboBoxModel) keyCombo.getModel();
keyComboModel.removeAllElements();
- for (String param : ui.getModel().getKeys()) {
- if (!params.contains(param)) {
- keyComboModel.addElement(param);
+
+ List<Caracteristic> availableCaracteristics = ui.getModel().getAvailableCaracteristics();
+ log.info(availableCaracteristics);
+ for (Caracteristic caracteristic : availableCaracteristics) {
+ if (!caracteristics.contains(caracteristic)) {
+ CaracteristicRow row = new CaracteristicRow(caracteristic.getName(), caracteristic);
+ keyComboModel.addElement(row);
}
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java 2012-12-20 16:08:26 UTC (rev 98)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java 2012-12-20 17:05:25 UTC (rev 99)
@@ -24,9 +24,12 @@
* #L%
*/
+import java.util.List;
+import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import com.google.common.collect.Maps;
import java.util.Map;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
import org.nuiton.util.beans.Binder;
@@ -41,11 +44,9 @@
*/
public class EnvironmentTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, EnvironmentRowModel, EnvironmentTabUIModel> {
- protected Map<Object, Object> environmentParameters;
+ protected CaracteristicMap environmentCaracteristics;
- public static final String KEY_BEAUFORT_SCALE = "beaufortScale";
- public static final String KEY_WIND_DIRECTION = "windDirection";
- public static final String KEY_SEA_STATE = "seaState";
+ protected List<Caracteristic> availableCaracteristics;
protected static final Binder<FishingOperation, EnvironmentTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, EnvironmentTabUIModel.class)
.toBinder();
@@ -57,28 +58,27 @@
super(FishingOperation.class, fromBeanBinder, toBeanBinder);
}
- public Map<Object, Object> getEnvironmentParameters() {
- return environmentParameters;
+ public CaracteristicMap getEnvironmentCaracteristics() {
+ return environmentCaracteristics;
}
- public void setEnvironmentParameters(Map<Object, Object> environmentParameters) {
- this.environmentParameters = environmentParameters;
+ public void setEnvironmentCaracteristics(CaracteristicMap environmentCaracteristics) {
+ this.environmentCaracteristics = environmentCaracteristics;
}
- public void setParameter(Object param, Object value) {
- Object oldValue = Maps.newLinkedHashMap(environmentParameters);
- environmentParameters.put(param, value);
- firePropertyChange(EditFishingOperationUIModel.PROPERTY_ENVIRONMENT_PARAMETERS, oldValue, environmentParameters);
+ public void setCaracteristic(Caracteristic caracteristic, Object value) {
+ Object oldValue = environmentCaracteristics.clone();
+ environmentCaracteristics.put(caracteristic, value);
+ firePropertyChange(EditFishingOperationUIModel.PROPERTY_ENVIRONMENT_CARACTERISTICS, oldValue, environmentCaracteristics);
}
- public String[] getKeys() {
- return new String[] {
- _(new String("tutti.table.fishing.environment.keys." + KEY_BEAUFORT_SCALE)),
- _(new String("tutti.table.fishing.environment.keys." + KEY_WIND_DIRECTION)),
- _(new String("tutti.table.fishing.environment.keys." + KEY_SEA_STATE)),
- _(new String("tutti.table.fishing.environment.keys." + "key3")),
- _(new String("tutti.table.fishing.environment.keys." + "key4")),
- _(new String("tutti.table.fishing.environment.keys." + "key5"))
- };
+ public List<Caracteristic> getAvailableCaracteristics() {
+ return availableCaracteristics;
}
+
+ public void setAvailableCaracteristics(List<Caracteristic> caracteristics) {
+// Object oldValue = availableCaracteristics;
+ availableCaracteristics = caracteristics;
+// firePropertyChange(EditFishingOperationUIModel.PROPERTY_ENVIRONMENT_CARACTERISTICS, oldValue, availableCaracteristics);
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java 2012-12-20 16:08:26 UTC (rev 98)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java 2012-12-20 17:05:25 UTC (rev 99)
@@ -24,7 +24,9 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import fr.ifremer.tutti.ui.swing.util.table.CaracteristicRow;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.beans.Binder;
@@ -35,39 +37,39 @@
* @author kmorin
* @since 0.3
*/
-public class GearShootingRowModel extends AbstractTuttiBeanUIModel<Object, GearShootingRowModel> {
+public class GearShootingRowModel extends AbstractTuttiBeanUIModel<CaracteristicRow, GearShootingRowModel> {
private static final Log log = LogFactory.getLog(GearShootingRowModel.class);
public static final String PROPERTY_KEY = "key";
public static final String PROPERTY_VALUE = "value";
- protected static final Binder<Object, GearShootingRowModel> fromBeanBinder =
- BinderFactory.newBinder(Object.class,
+ protected static final Binder<CaracteristicRow, GearShootingRowModel> fromBeanBinder =
+ BinderFactory.newBinder(CaracteristicRow.class,
GearShootingRowModel.class);
- protected static final Binder<GearShootingRowModel, Object> toBeanBinder =
+ protected static final Binder<GearShootingRowModel, CaracteristicRow> toBeanBinder =
BinderFactory.newBinder(GearShootingRowModel.class,
- Object.class);
+ CaracteristicRow.class);
- protected String key;
+ protected Caracteristic key;
protected String value;
public GearShootingRowModel() {
- super(Object.class, fromBeanBinder, toBeanBinder);
+ super(CaracteristicRow.class, fromBeanBinder, toBeanBinder);
}
- public GearShootingRowModel(String key) {
+ public GearShootingRowModel(Caracteristic key) {
this();
this.key = key;
}
- public String getKey() {
+ public Caracteristic getKey() {
return key;
}
- public void setKey(String key) {
+ public void setKey(Caracteristic key) {
Object oldValue = getKey();
this.key = key;
firePropertyChange(PROPERTY_KEY, oldValue, key);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java 2012-12-20 16:08:26 UTC (rev 98)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java 2012-12-20 17:05:25 UTC (rev 99)
@@ -25,14 +25,16 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.tutti.ui.swing.util.table.CaracteristicRow;
import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.event.ListDataEvent;
@@ -155,7 +157,7 @@
TuttiBeanMonitor<GearShootingRowModel> monitor = getRowMonitor();
GearShootingRowModel row = monitor.getBean();
if (row != null) {
- ui.getModel().setParameter(row.getKey(), row.getValue());
+ ui.getModel().setCaracteristic(row.getKey(), row.getValue());
}
}
};
@@ -177,10 +179,10 @@
*/
public void addRow() {
JComboBox keyCombo = ui.getNewRowKey();
- String key = (String) keyCombo.getSelectedItem();
+ Caracteristic key = (Caracteristic) keyCombo.getSelectedItem();
GearShootingRowModel row = new GearShootingRowModel(key);
getTableModel().addNewRow(getTable().getRowCount(), row);
- ui.getModel().setParameter(key, null);
+ ui.getModel().setCaracteristic(key, null);
keyCombo.removeItem(key);
}
@@ -189,12 +191,12 @@
* Resets the table with the data from the database
*/
public void reset() {
- Map<Object, Object> gearShootingParameters = ui.getModel().getGearShootingParameters();
+ CaracteristicMap gearShootingCaracteristics = ui.getModel().getGearShootingCaracteristics();
List<GearShootingRowModel> rows = Lists.newArrayList();
- Collection<Object> params = gearShootingParameters.keySet();
- for (Object key : gearShootingParameters.keySet()) {
- rows.add(new GearShootingRowModel(key.toString()));
+ Collection<Caracteristic> caracteristics = gearShootingCaracteristics.keySet();
+ for (Caracteristic key : gearShootingCaracteristics.keySet()) {
+ rows.add(new GearShootingRowModel(key));
}
AbstractTuttiTableModel<GearShootingRowModel> tableModel = getTableModel();
@@ -203,9 +205,13 @@
JComboBox keyCombo = ui.getNewRowKey();
DefaultComboBoxModel keyComboModel = (DefaultComboBoxModel) keyCombo.getModel();
keyComboModel.removeAllElements();
- for (String param : ui.getModel().getKeys()) {
- if (!params.contains(param)) {
- keyComboModel.addElement(param);
+
+ List<Caracteristic> availableCaracteristics = ui.getModel().getAvailableCaracteristics();
+ log.info(availableCaracteristics);
+ for (Caracteristic caracteristic : availableCaracteristics) {
+ if (!caracteristics.contains(caracteristic)) {
+ CaracteristicRow row = new CaracteristicRow(caracteristic.getName(), caracteristic);
+ keyComboModel.addElement(row);
}
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIModel.java 2012-12-20 16:08:26 UTC (rev 98)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIModel.java 2012-12-20 17:05:25 UTC (rev 99)
@@ -24,16 +24,16 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import com.google.common.collect.Maps;
-import java.util.Map;
+import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import java.util.HashMap;
+import java.util.List;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderModelBuilder;
-import static org.nuiton.i18n.I18n._;
/**
*
@@ -42,16 +42,9 @@
*/
public class GearShootingTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, GearShootingRowModel, GearShootingTabUIModel> {
- protected Map<Object, Object> gearShootingParameters;
+ protected CaracteristicMap gearShootingCaracteristics;
- public static final String KEY_START_DEPTH = "startDepth";
- public static final String KEY_END_DEPTH = "endDepth";
- public static final String KEY_VERTICAL_APERTURE = "verticalAperture";
- public static final String KEY_HORIZONTAL_APERTURE = "horizontalAperture";
- public static final String KEY_WARP_LENGTH = "warpLength";
- public static final String KEY_ARM_LENGTH = "armLength";
- public static final String KEY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul";
- public static final String KEY_MEASURED_GEOMETRY = "measuredGeometry";
+ protected List<Caracteristic> availableCaracteristics;
protected static final Binder<FishingOperation, GearShootingTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, GearShootingTabUIModel.class)
.toBinder();
@@ -63,33 +56,26 @@
super(FishingOperation.class, fromBeanBinder, toBeanBinder);
}
- public Map<Object, Object> getGearShootingParameters() {
- return gearShootingParameters;
+ public CaracteristicMap getGearShootingCaracteristics() {
+ return gearShootingCaracteristics;
}
- public void setGearShootingParameters(Map<Object, Object> gearShooting) {
- this.gearShootingParameters = gearShooting;
+ public void setGearShootingCaracteristics(CaracteristicMap gearShooting) {
+ this.gearShootingCaracteristics = gearShooting;
}
- public void setParameter(Object param, Object value) {
- Object oldValue = Maps.newLinkedHashMap(gearShootingParameters);
- gearShootingParameters.put(param, value);
- firePropertyChange(EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_PARAMETERS, oldValue, gearShootingParameters);
+ public void setCaracteristic(Caracteristic caracteristic, Object value) {
+ Object oldValue = Maps.newLinkedHashMap(gearShootingCaracteristics);
+ gearShootingCaracteristics.put(caracteristic, value);
+ firePropertyChange(EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_CARACTERISTICS, oldValue, gearShootingCaracteristics);
}
-
- public String[] getKeys() {
- return new String[] {
- _(new String("tutti.table.fishing.gearShooting.keys." + KEY_START_DEPTH)),
- _(new String("tutti.table.fishing.gearShooting.keys." + KEY_END_DEPTH)),
- _(new String("tutti.table.fishing.gearShooting.keys." + KEY_HORIZONTAL_APERTURE)),
- _(new String("tutti.table.fishing.gearShooting.keys." + KEY_VERTICAL_APERTURE)),
- _(new String("tutti.table.fishing.gearShooting.keys." + KEY_WARP_LENGTH)),
- _(new String("tutti.table.fishing.gearShooting.keys." + KEY_ARM_LENGTH)),
- _(new String("tutti.table.fishing.gearShooting.keys." + KEY_SYSTEME_FERMETURE_CUL)),
- _(new String("tutti.table.fishing.gearShooting.keys." + KEY_MEASURED_GEOMETRY)),
- _(new String("tutti.table.fishing.gearShooting.keys." + "key3")),
- _(new String("tutti.table.fishing.gearShooting.keys." + "key4")),
- _(new String("tutti.table.fishing.gearShooting.keys." + "key5"))
- };
+
+ public List<Caracteristic> getAvailableCaracteristics() {
+ return availableCaracteristics;
}
+
+ public void setAvailableCaracteristics(List<Caracteristic> availableCaracteristics) {
+ this.availableCaracteristics = availableCaracteristics;
+ }
+
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java 2012-12-20 16:08:26 UTC (rev 98)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java 2012-12-20 17:05:25 UTC (rev 99)
@@ -24,7 +24,9 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import fr.ifremer.tutti.ui.swing.util.table.CaracteristicRow;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.beans.Binder;
@@ -35,7 +37,7 @@
* @author kmorin
* @since 0.3
*/
-public class HydrologyRowModel extends AbstractTuttiBeanUIModel<Object, HydrologyRowModel> {
+public class HydrologyRowModel extends AbstractTuttiBeanUIModel<CaracteristicRow, HydrologyRowModel> {
private static final Log log = LogFactory.getLog(HydrologyRowModel.class);
@@ -44,15 +46,15 @@
public static final String PROPERTY_GEAR_SHOOTING_END_VALUE = "gearShootingEndValue";
public static final String PROPERTY_AVERAGE_VALUE = "averageValue";
- protected static final Binder<Object, HydrologyRowModel> fromBeanBinder =
- BinderFactory.newBinder(Object.class,
+ protected static final Binder<CaracteristicRow, HydrologyRowModel> fromBeanBinder =
+ BinderFactory.newBinder(CaracteristicRow.class,
HydrologyRowModel.class);
- protected static final Binder<HydrologyRowModel, Object> toBeanBinder =
+ protected static final Binder<HydrologyRowModel, CaracteristicRow> toBeanBinder =
BinderFactory.newBinder(HydrologyRowModel.class,
- Object.class);
+ CaracteristicRow.class);
- protected String key;
+ protected Caracteristic key;
protected String gearShootingStartValue;
@@ -61,19 +63,19 @@
protected String averageValue;
public HydrologyRowModel() {
- super(Object.class, fromBeanBinder, toBeanBinder);
+ super(CaracteristicRow.class, fromBeanBinder, toBeanBinder);
}
- public HydrologyRowModel(String key) {
+ public HydrologyRowModel(Caracteristic key) {
this();
this.key = key;
}
- public String getKey() {
+ public Caracteristic getKey() {
return key;
}
- public void setKey(String key) {
+ public void setKey(Caracteristic key) {
Object oldValue = getKey();
this.key = key;
firePropertyChange(PROPERTY_KEY, oldValue, key);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java 2012-12-20 16:08:26 UTC (rev 98)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java 2012-12-20 17:05:25 UTC (rev 99)
@@ -25,14 +25,16 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.tutti.ui.swing.util.table.CaracteristicRow;
import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.event.ListDataEvent;
@@ -169,7 +171,7 @@
TuttiBeanMonitor<HydrologyRowModel> monitor = getRowMonitor();
HydrologyRowModel row = monitor.getBean();
if (row != null) {
- ui.getModel().setParameter(row.getKey(),
+ ui.getModel().setCaracteristic(row.getKey(),
row.getGearShootingStartValue(),
row.getGearShootingEndValue(),
row.getAverageValue()
@@ -194,25 +196,25 @@
* Adds a row with the parameter selected in the combo box
*/
public void addRow() {
- JComboBox keyCombo = ui.getNewRowKey();
- String key = (String) keyCombo.getSelectedItem();
- HydrologyRowModel row = new HydrologyRowModel(key);
- getTableModel().addNewRow(getTable().getRowCount(), row);
- ui.getModel().setParameter(key, null, null, null);
-
- keyCombo.removeItem(key);
+// JComboBox keyCombo = ui.getNewRowKey();
+// CaracteristicRow key = (CaracteristicRow) keyCombo.getSelectedItem();
+// HydrologyRowModel row = new HydrologyRowModel(key);
+// getTableModel().addNewRow(getTable().getRowCount(), row);
+// ui.getModel().setCaracteristic(row.getKey(), null, null, null);
+//
+// keyCombo.removeItem(key);
}
/**
* Resets the table with the data from the database
*/
public void reset() {
- Map<Object, Object> hydrologyParameters = ui.getModel().getHydrologyParameters();
+ CaracteristicMap hydrologyCaracteristics = ui.getModel().getHydrologyCaracteristics();
List<HydrologyRowModel> rows = Lists.newArrayList();
- Collection<Object> params = hydrologyParameters.keySet();
- for (Object key : hydrologyParameters.keySet()) {
- rows.add(new HydrologyRowModel(key.toString()));
+ Collection<Caracteristic> caracteristics = hydrologyCaracteristics.keySet();
+ for (Caracteristic key : hydrologyCaracteristics.keySet()) {
+ rows.add(new HydrologyRowModel(key));
}
AbstractTuttiTableModel<HydrologyRowModel> tableModel = getTableModel();
@@ -221,9 +223,13 @@
JComboBox keyCombo = ui.getNewRowKey();
DefaultComboBoxModel keyComboModel = (DefaultComboBoxModel) keyCombo.getModel();
keyComboModel.removeAllElements();
- for (String param : ui.getModel().getKeys()) {
- if (!params.contains(param)) {
- keyComboModel.addElement(param);
+
+ List<Caracteristic> availableCaracteristics = ui.getModel().getAvailableCaracteristics();
+ log.info(availableCaracteristics);
+ for (Caracteristic caracteristic : availableCaracteristics) {
+ if (!caracteristics.contains(caracteristic)) {
+ CaracteristicRow row = new CaracteristicRow(caracteristic.getName(), caracteristic);
+ keyComboModel.addElement(row);
}
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java 2012-12-20 16:08:26 UTC (rev 98)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java 2012-12-20 17:05:25 UTC (rev 99)
@@ -25,14 +25,15 @@
*/
import com.google.common.collect.Maps;
-import java.util.Map;
+import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+import java.util.List;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderModelBuilder;
-import static org.nuiton.i18n.I18n._;
/**
*
@@ -41,15 +42,9 @@
*/
public class HydrologyTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, HydrologyRowModel, HydrologyTabUIModel> {
- protected Map<Object, Object> hydrologyParameters;
+ protected CaracteristicMap hydrologyCaracteristics;
- public static final String GEAR_SHOOTING_START = "gearShootingStart";
- public static final String GEAR_SHOOTING_END = "gearShootingEnd";
- public static final String AVERAGE = "average";
- public static final String SURFACE = "surface";
- public static final String BOTTOM = "bottom";
- public static final String TEMPERATURE = "temperature";
- public static final String SALINITY = "salinity";
+ protected List<Caracteristic> availableCaracteristics;
protected static final Binder<FishingOperation, HydrologyTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, HydrologyTabUIModel.class)
.toBinder();
@@ -61,33 +56,30 @@
super(FishingOperation.class, fromBeanBinder, toBeanBinder);
}
- public Map<Object, Object> getHydrologyParameters() {
- return hydrologyParameters;
+ public CaracteristicMap getHydrologyCaracteristics() {
+ return hydrologyCaracteristics;
}
- public void setHydrologyParameters(Map<Object, Object> environmentParameters) {
- this.hydrologyParameters = environmentParameters;
+ public void setHydrologyCaracteristics(CaracteristicMap hydrologyCaracteristics) {
+ this.hydrologyCaracteristics = hydrologyCaracteristics;
}
- public void setParameter(Object param, Object gearShootingStartValue,
+ public void setCaracteristic(Caracteristic param, Object gearShootingStartValue,
Object gearShootingEndValue, Object averageValue) {
- Object oldValue = Maps.newLinkedHashMap(hydrologyParameters);
- hydrologyParameters.put(param + "." + GEAR_SHOOTING_START, gearShootingStartValue);
- hydrologyParameters.put(param + "." + GEAR_SHOOTING_END, gearShootingEndValue);
- hydrologyParameters.put(param + "." + AVERAGE, averageValue);
- firePropertyChange(EditFishingOperationUIModel.PROPERTY_HYDROLOGY_PARAMETERS, oldValue, hydrologyParameters);
+ Object oldValue = Maps.newLinkedHashMap(hydrologyCaracteristics);
+// hydrologyCaracteristics.put(param + "." + GEAR_SHOOTING_START, gearShootingStartValue);
+// hydrologyCaracteristics.put(param + "." + GEAR_SHOOTING_END, gearShootingEndValue);
+// hydrologyCaracteristics.put(param + "." + AVERAGE, averageValue);
+ firePropertyChange(EditFishingOperationUIModel.PROPERTY_HYDROLOGY_CARACTERISTICS, oldValue, hydrologyCaracteristics);
}
-
- public String[] getKeys() {
- return new String[] {
- _(new String("tutti.table.fishing.hydrology.keys." + TEMPERATURE + "." + SURFACE)),
- _(new String("tutti.table.fishing.hydrology.keys." + TEMPERATURE + "." + BOTTOM)),
- _(new String("tutti.table.fishing.hydrology.keys." + SALINITY + "." + SURFACE)),
- _(new String("tutti.table.fishing.hydrology.keys." + SALINITY + "." + BOTTOM)),
- _(new String("tutti.table.fishing.hydrology.keys." + "key3")),
- _(new String("tutti.table.fishing.hydrology.keys." + "key4")),
- _(new String("tutti.table.fishing.hydrology.keys." + "key5"))
- };
+
+ public List<Caracteristic> getAvailableCaracteristics() {
+ return availableCaracteristics;
}
+
+ public void setAvailableCaracteristics(List<Caracteristic> availableCaracteristics) {
+ this.availableCaracteristics = availableCaracteristics;
+ }
+
}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/CaracteristicRow.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/CaracteristicRow.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/CaracteristicRow.java 2012-12-20 17:05:25 UTC (rev 99)
@@ -0,0 +1,42 @@
+package fr.ifremer.tutti.ui.swing.util.table;
+
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+
+/**
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 0.3
+ */
+public class CaracteristicRow {
+
+ protected Caracteristic[] caracteristics;
+
+ protected String name;
+
+ public CaracteristicRow(String name, Caracteristic... caracteristics) {
+ this.name = name;
+ this.caracteristics = caracteristics;
+ }
+
+ public Caracteristic[] getCaracteristics() {
+ return caracteristics;
+ }
+
+ public void setCaracteristics(Caracteristic[] caracteristics) {
+ this.caracteristics = caracteristics;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+}
1
0
Dec. 20, 2012
Author: tchemit
Date: 2012-12-20 17:08:26 +0100 (Thu, 20 Dec 2012)
New Revision: 98
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/98
Log:
back to compilerPlugin 2.5.1 + rename sorted and unsorted field in fishingOperation
Modified:
trunk/pom.xml
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/pom.xml 2012-12-20 16:08:26 UTC (rev 98)
@@ -81,6 +81,9 @@
<platform>forge.codelutin.com</platform>
<projectId>tutti</projectId>
+ <!-- Remove this when using mavenpom 3.4.7 -->
+ <compilerPluginVersion>2.5.1</compilerPluginVersion>
+
<!-- libraries version -->
<nuitonUtilsVersion>2.6.5</nuitonUtilsVersion>
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java 2012-12-20 16:08:26 UTC (rev 98)
@@ -36,7 +36,6 @@
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
@@ -61,9 +60,8 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public abstract class AbstractTuttiBatchTableUIHandler<R extends AbstractTuttiBeanUIModel, M extends AbstractTuttiTableUIModel<?, R, M>> extends AbstractTuttiTableUIHandler<R, M> {
+public abstract class AbstractTuttiBatchTableUIHandler<R extends AbstractTuttiBeanUIModel, M extends AbstractTuttiBatchUIModel<R, M>> extends AbstractTuttiTableUIHandler<R, M> {
-
/** Logger. */
private static final Log log =
LogFactory.getLog(AbstractTuttiBatchTableUIHandler.class);
@@ -85,7 +83,7 @@
*/
protected final PersistenceService persistenceService;
- protected AbstractTuttiBatchTableUIHandler(TuttiUI<?,?> parentUi,
+ protected AbstractTuttiBatchTableUIHandler(TuttiUI<?, ?> parentUi,
String... properties) {
super(parentUi.getHandler().getContext(), properties);
this.persistenceService = context.getService(PersistenceService.class);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2012-12-20 16:08:26 UTC (rev 98)
@@ -248,23 +248,22 @@
horizontalAlignment: {JLabel.CENTER};
}
+#createFishingOperationActions {
+ visible: {model.isEmpty()};
+}
+
#saveButton {
actionIcon: "save";
text: "tutti.action.save";
- enabled: {model.isModify() && model.isValid()};
+ enabled: {model.isValid()};
}
#cancelButton {
actionIcon: "cancel";
text: "tutti.action.cancel";
- enabled: {model.isModify()};
+ /*enabled: {model.isModify()};*/
}
-#importPupitriButton {
- actionIcon: "pupitri-import";
- text: "tutti.action.pupitri-import";
-}
-
#importCasinoButton {
actionIcon: "casino-import";
text: "tutti.action.casino-import";
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2012-12-20 16:08:26 UTC (rev 98)
@@ -295,7 +295,8 @@
<tab id='traitGearShootingTab'
title='tutti.label.tab.fishingOperation.gearShooting'>
- <GearShootingTabUI id='gearShootingTabContent' constructorParams='this'/>
+ <GearShootingTabUI id='gearShootingTabContent'
+ constructorParams='this'/>
</tab>
<tab id='environmentTab'
@@ -314,7 +315,8 @@
<!-- Actions -->
<JPanel layout='{new BorderLayout()}' constraints='BorderLayout.SOUTH'>
- <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.CENTER'>
+ <JPanel id='createFishingOperationActions' layout='{new GridLayout(1,0)}'
+ constraints='BorderLayout.CENTER'>
<JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
<JButton id='saveButton' onActionPerformed='handler.save()'/>
</JPanel>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-20 16:08:26 UTC (rev 98)
@@ -24,7 +24,6 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.content.operation.fishing.gearshooting.GearShootingTabUI;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
@@ -36,9 +35,11 @@
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.environment.EnvironmentTabUI;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.environment.EnvironmentTabUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.fishing.gearshooting.GearShootingTabUI;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.gearshooting.GearShootingTabUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology.HydrologyTabUI;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology.HydrologyTabUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -72,11 +73,38 @@
private final PersistenceService persistenceService;
- public EditFishingOperationUIHandler(FishingOperationsUI parentUi, EditFishingOperationUI ui) {
+ /**
+ * To monitor changes on the incoming fishing operation.
+ *
+ * @since 0.3
+ */
+ private final TuttiBeanMonitor<EditFishingOperationUIModel> fishingOperationMonitor;
+
+ public EditFishingOperationUIHandler(FishingOperationsUI parentUi,
+ EditFishingOperationUI ui) {
super(parentUi.getHandler().getContext());
this.ui = ui;
this.parentUi = parentUi;
this.persistenceService = context.getService(PersistenceService.class);
+ this.fishingOperationMonitor = new TuttiBeanMonitor<EditFishingOperationUIModel>(
+ EditFishingOperationUIModel.PROPERTY_STATION_NUMBER,
+ EditFishingOperationUIModel.PROPERTY_FISHING_OPERATION_NUMBER,
+ EditFishingOperationUIModel.PROPERTY_DATE,
+ EditFishingOperationUIModel.PROPERTY_STRATA,
+ EditFishingOperationUIModel.PROPERTY_SUB_STRATA,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_DATE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_DATE,
+ EditFishingOperationUIModel.PROPERTY_FISHING_OPERATION_RECTILIGNE,
+ EditFishingOperationUIModel.PROPERTY_DISTANCE_CHALUTEE,
+ EditFishingOperationUIModel.PROPERTY_DUREE,
+ EditFishingOperationUIModel.PROPERTY_FISHING_OPERATION_VALID,
+ EditFishingOperationUIModel.PROPERTY_LOCATION,
+ EditFishingOperationUIModel.PROPERTY_COMMENT,
+ EditFishingOperationUIModel.PROPERTY_SAISISSEUR);
}
@Override
@@ -119,9 +147,11 @@
}
});
- listModelIsModify(model);
+// listModelIsModify(model);
ui.setContextValue(model);
+
+ fishingOperationMonitor.setBean(model);
}
@Override
@@ -184,9 +214,9 @@
model.setEmpty(true);
listenValidatorValid(ui.getValidator(), getModel());
-
+
//init gear shooting
- GearShootingTabUIModel gearShootingModel =
+ GearShootingTabUIModel gearShootingModel =
ui.getGearShootingTabContent().getModel();
gearShootingModel.addPropertyChangeListener(
EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_PARAMETERS,
@@ -194,16 +224,16 @@
public void propertyChange(PropertyChangeEvent evt) {
model.setModify(true);
- model.setGearShootingParameters((Map<Object, Object>)evt.getNewValue());
+ model.setGearShootingParameters((Map<Object, Object>) evt.getNewValue());
}
}
- );
+ );
Map<Object, Object> gearShootingParams = getDefaultGearShootingParams();
ui.getModel().setGearShootingParameters(gearShootingParams);
gearShootingModel.setGearShootingParameters(gearShootingParams);
-
+
//init environment
- EnvironmentTabUIModel environmentModel =
+ EnvironmentTabUIModel environmentModel =
ui.getEnvironmentTabContent().getModel();
environmentModel.addPropertyChangeListener(
EditFishingOperationUIModel.PROPERTY_ENVIRONMENT_PARAMETERS,
@@ -211,16 +241,16 @@
public void propertyChange(PropertyChangeEvent evt) {
model.setModify(true);
- model.setEnvironmentParameters((Map<Object, Object>)evt.getNewValue());
+ model.setEnvironmentParameters((Map<Object, Object>) evt.getNewValue());
}
}
- );
+ );
Map<Object, Object> environmentParams = getDefaultEnvironmentParams();
ui.getModel().setEnvironmentParameters(environmentParams);
environmentModel.setEnvironmentParameters(environmentParams);
-
+
//init hydrology
- HydrologyTabUIModel hydrologyModel =
+ HydrologyTabUIModel hydrologyModel =
ui.getHydrologyTabContent().getModel();
hydrologyModel.addPropertyChangeListener(
EditFishingOperationUIModel.PROPERTY_HYDROLOGY_PARAMETERS,
@@ -270,10 +300,10 @@
_(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_MEASURED_GEOMETRY)),
null
);
-
+
return gearShootingParams;
}
-
+
protected Map<Object, Object> getDefaultEnvironmentParams() {
Map<Object, Object> environmentParams = Maps.newLinkedHashMap();
environmentParams.put(
@@ -296,19 +326,19 @@
hydrologyParams.put(
_(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.TEMPERATURE + "." + HydrologyTabUIModel.SURFACE)),
null
- );
+ );
hydrologyParams.put(
- _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.TEMPERATURE + "." + HydrologyTabUIModel.BOTTOM)),
+ _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.TEMPERATURE + "." + HydrologyTabUIModel.BOTTOM)),
null
- );
+ );
hydrologyParams.put(
_(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.SALINITY + "." + HydrologyTabUIModel.SURFACE)),
null
- );
+ );
hydrologyParams.put(
- _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.SALINITY + "." + HydrologyTabUIModel.BOTTOM)),
+ _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.SALINITY + "." + HydrologyTabUIModel.BOTTOM)),
null
- );
+ );
return hydrologyParams;
}
@@ -323,6 +353,31 @@
public void selectFishingOperation(FishingOperation bean) {
+ if (fishingOperationMonitor.wasModified()) {
+
+ // previous fishingOperation was modified, let's save it
+ EditFishingOperationUIModel beanToSave = fishingOperationMonitor.getBean();
+
+ if (beanToSave.isEmpty()) {
+
+ // user must use save button
+ if (log.isWarnEnabled()) {
+ log.warn("Won't save new fishing operation, use explicit save button instead...");
+ }
+ } else {
+
+ // save modified fishing operation
+ FishingOperation toSave = beanToSave.toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("FishingOperation " + toSave.getId() +
+ " was modified, will save it.");
+ }
+
+ parentUi.getHandler().saveFishingOperation(toSave);
+ }
+ }
+
boolean empty = bean == null;
EditFishingOperationUIModel model = getModel();
@@ -338,6 +393,11 @@
model.fromBean(bean);
+ // to be sure combo list will be reloaded
+ model.setStrata(null);
+ model.setSubStrata(null);
+ model.setLocation(null);
+
if (strata != null) {
ui.getStrataComboBox().setSelectedItem(strata);
}
@@ -366,16 +426,18 @@
GearShootingTabUI gearShootingTab = ui.getGearShootingTabContent();
gearShootingTab.getModel().setGearShootingParameters(getDefaultGearShootingParams());
gearShootingTab.getHandler().reset();
-
+
//reset environment
EnvironmentTabUI environmentTab = ui.getEnvironmentTabContent();
environmentTab.getModel().setEnvironmentParameters(getDefaultEnvironmentParams());
environmentTab.getHandler().reset();
-
+
//reset hydrology
HydrologyTabUI hydrologyTab = ui.getHydrologyTabContent();
hydrologyTab.getModel().setHydrologyParameters(getDefaultHydrologyParams());
hydrologyTab.getHandler().reset();
+
+ fishingOperationMonitor.clearModified();
}
public void cancel() {
@@ -419,21 +481,17 @@
// reselect current tab
ui.getFishingOperationTabPane().setSelectedIndex(selectedIndex);
- getModel().setModify(false);
-
+// getModel().setModify(false);
+
for (Object key : ui.getModel().getEnvironmentParameters().keySet()) {
log.info(key + " : " + ui.getModel().getEnvironmentParameters().get(key));
}
-
+
for (Object key : ui.getModel().getHydrologyParameters().keySet()) {
log.info(key + " : " + ui.getModel().getHydrologyParameters().get(key));
}
}
- public void importPupitri() {
- //TODO
- }
-
public void importCasino() {
//TODO
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-20 16:08:26 UTC (rev 98)
@@ -198,16 +198,13 @@
}
// propagate fishingOperation to his tabs
- ui.getFishingOperationTabContent().getHandler().selectFishingOperation(fishingOperation
- );
+ ui.getFishingOperationTabContent().getHandler().selectFishingOperation(fishingOperation);
ui.getCatchesTabContent().getHandler().selectFishingOperation(fishingOperation,
fishingOperationText);
-
// repaint tabs
ui.getTabPane().repaint();
-// ui.getObservationIndividuelTabContent().selectFishingOperation(selectedFishingOperation);
}
public void saveFishingOperation(FishingOperation toSave) {
@@ -229,7 +226,8 @@
List<FishingOperation> data = model.getFishingOperation();
- FishingOperation existingFishingOperation = TuttiEntities.findById(data, savedFishingOperation.getId());
+ FishingOperation existingFishingOperation =
+ TuttiEntities.findById(data, savedFishingOperation.getId());
if (existingFishingOperation != null) {
data.remove(existingFishingOperation);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2012-12-20 16:08:26 UTC (rev 98)
@@ -61,37 +61,37 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#speciesTotalVracWeightLabel {
- text: "tutti.label.catches.speciesTotalVracWeight";
- labelFor: {speciesTotalVracWeightField};
+#speciesTotalSortedWeightLabel {
+ text: "tutti.label.catches.speciesTotalSortedWeight";
+ labelFor: {speciesTotalSortedWeightField};
}
-#speciesTotalVracWeightField {
- property: "speciesTotalVracWeight";
- model: {model.getSpeciesTotalVracWeight()};
+#speciesTotalSortedWeightField {
+ property: "speciesTotalSortedWeight";
+ model: {model.getSpeciesTotalSortedWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#speciesSampleVracWeightLabel {
- text: "tutti.label.catches.speciesSampleVracWeight";
- labelFor: {speciesSampleVracWeightField};
+#speciesSampleSortedWeightLabel {
+ text: "tutti.label.catches.speciesSampleSortedWeight";
+ labelFor: {speciesSampleSortedWeightField};
}
-#speciesSampleVracWeightField {
- property: "speciesSampleVracWeight";
- model: {model.getSpeciesSampleVracWeight()};
+#speciesSampleSortedWeightField {
+ property: "speciesSampleSortedWeight";
+ model: {model.getSpeciesSampleSortedWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#speciesTotalHorsVracWeightLabel {
- text: "tutti.label.catches.speciesTotalHorsVracWeight";
- labelFor: {speciesTotalHorsVracWeightField};
+#speciesTotalUnsortedWeightLabel {
+ text: "tutti.label.catches.speciesTotalUnsortedWeight";
+ labelFor: {speciesTotalUnsortedWeightField};
}
-#speciesTotalHorsVracWeightField {
- text: {getStringValue(model.getSpeciesTotalHorsVracWeight())};
+#speciesTotalUnsortedWeightField {
+ text: {getStringValue(model.getSpeciesTotalUnsortedWeight())};
editable: false;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2012-12-20 16:08:26 UTC (rev 98)
@@ -25,8 +25,6 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditCatchesUIModel, EditCatchesUIHandler>'>
<import>
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
fr.ifremer.tutti.ui.swing.content.operation.accidental.AccidentalBatchUI
fr.ifremer.tutti.ui.swing.content.operation.benthos.BenthosBatchUI
@@ -34,10 +32,7 @@
fr.ifremer.tutti.ui.swing.content.operation.plankton.PlanktonBatchUI
fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchUI
fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI
- fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
- fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
- org.jdesktop.swingx.JXTable
org.jdesktop.swingx.JXTitledPanel
jaxx.runtime.swing.editor.NumberEditor
@@ -45,10 +40,6 @@
jaxx.runtime.validator.swing.SwingValidatorUtil
jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
- javax.swing.ListSelectionModel
-
- java.awt.Color
-
static org.nuiton.i18n.I18n._
static jaxx.runtime.SwingUtil.getStringValue
</import>
@@ -77,12 +68,12 @@
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
<field name='speciesTotalWeight'
component='speciesTotalWeightField'/>
- <field name='speciesTotalVracWeight'
- component='speciesTotalVracWeightField'/>
- <field name='speciesSampleVracWeight'
- component='speciesSampleVracWeightField'/>
- <field name='speciesTotalHorsVracWeight'
- component='speciesTotalHorsVracWeightField'/>
+ <field name='speciesTotalSortedWeight'
+ component='speciesTotalSortedWeightField'/>
+ <field name='speciesSampleSortedWeight'
+ component='speciesSampleSortedWeightField'/>
+ <field name='speciesTotalUnsortedWeight'
+ component='speciesTotalUnsortedWeightField'/>
<field name='benthosTotalWeight'
component='benthosTotalWeightField'/>
<field name='benthosSampleTotalWeight'
@@ -114,10 +105,10 @@
constructorParams='this'/>
</cell>
<cell anchor='west'>
- <JLabel id='speciesTotalVracWeightLabel'/>
+ <JLabel id='speciesTotalSortedWeightLabel'/>
</cell>
<cell weightx='1.0'>
- <NumberEditor id='speciesTotalVracWeightField'
+ <NumberEditor id='speciesTotalSortedWeightField'
constructorParams='this'/>
</cell>
</row>
@@ -125,17 +116,17 @@
<!-- Poids échantillonné vrac / Poids total hors vrac -->
<row>
<cell>
- <JLabel id='speciesSampleVracWeightLabel'/>
+ <JLabel id='speciesSampleSortedWeightLabel'/>
</cell>
<cell>
- <NumberEditor id='speciesSampleVracWeightField'
+ <NumberEditor id='speciesSampleSortedWeightField'
constructorParams='this'/>
</cell>
<cell>
- <JLabel id='speciesTotalHorsVracWeightLabel'/>
+ <JLabel id='speciesTotalUnsortedWeightLabel'/>
</cell>
<cell>
- <JTextField id='speciesTotalHorsVracWeightField'/>
+ <JTextField id='speciesTotalUnsortedWeightField'/>
</cell>
</row>
</Table>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2012-12-20 16:08:26 UTC (rev 98)
@@ -69,9 +69,9 @@
this.persistenceService = context.getService(PersistenceService.class);
this.fishingOperationMonitor = new TuttiBeanMonitor<EditCatchesUIModel>(
EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_UNSORTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_SAMPLE_SORTED_WEIGHT,
EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_WEIGHT,
EditCatchesUIModel.PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT,
EditCatchesUIModel.PROPERTY_PLANKTON_TOTAL_WEIGHT,
@@ -97,6 +97,12 @@
@Override
public void onCloseUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("closing: " + ui);
+ }
+
+ // close batches tabs, then general tab
}
@Override
@@ -150,16 +156,11 @@
ui.getMacroWasteTabFishingOperationReminderLabel().setTitle(fishingOperationText);
ui.getAccidentalTabFishingOperationReminderLabel().setTitle(fishingOperationText);
- ui.getSpeciesTabContent().getHandler().selectFishingOperation(bean
- );
- ui.getBenthosTabContent().getHandler().selectFishingOperation(bean
- );
- ui.getPlanktonTabContent().getHandler().selectFishingOperation(bean
- );
- ui.getMacroWasteTabContent().getHandler().selectFishingOperation(bean
- );
- ui.getAccidentalTabContent().getHandler().selectFishingOperation(bean
- );
+ ui.getSpeciesTabContent().getHandler().selectFishingOperation(bean);
+ ui.getBenthosTabContent().getHandler().selectFishingOperation(bean);
+ ui.getPlanktonTabContent().getHandler().selectFishingOperation(bean);
+ ui.getMacroWasteTabContent().getHandler().selectFishingOperation(bean);
+ ui.getAccidentalTabContent().getHandler().selectFishingOperation(bean);
ui.getTabPane().repaint();
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2012-12-20 16:08:26 UTC (rev 98)
@@ -39,11 +39,11 @@
public static final String PROPERTY_SPECIES_TOTAL_WEIGHT = "speciesTotalWeight";
- public static final String PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT = "speciesTotalVracWeight";
+ public static final String PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT = "speciesTotalSortedWeight";
- public static final String PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT = "speciesSampleVracWeight";
+ public static final String PROPERTY_SPECIES_SAMPLE_SORTED_WEIGHT = "speciesSampleSortedWeight";
- public static final String PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT = "speciesTotalHorsVracWeight";
+ public static final String PROPERTY_SPECIES_TOTAL_UNSORTED_WEIGHT = "speciesTotalUnsortedWeight";
public static final String PROPERTY_BENTHOS_TOTAL_WEIGHT = "benthosTotalWeight";
@@ -60,9 +60,9 @@
protected static final Binder<FishingOperation, EditCatchesUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, EditCatchesUIModel.class)
.addSimpleProperties(
PROPERTY_SPECIES_TOTAL_WEIGHT,
- PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT,
- PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT,
- PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT,
+ PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT,
+ PROPERTY_SPECIES_TOTAL_UNSORTED_WEIGHT,
+ PROPERTY_SPECIES_SAMPLE_SORTED_WEIGHT,
PROPERTY_BENTHOS_TOTAL_WEIGHT,
PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT,
PROPERTY_PLANKTON_TOTAL_WEIGHT,
@@ -73,9 +73,9 @@
protected static final Binder<EditCatchesUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(EditCatchesUIModel.class, FishingOperation.class)
.addSimpleProperties(
PROPERTY_SPECIES_TOTAL_WEIGHT,
- PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT,
- PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT,
- PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT,
+ PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT,
+ PROPERTY_SPECIES_TOTAL_UNSORTED_WEIGHT,
+ PROPERTY_SPECIES_SAMPLE_SORTED_WEIGHT,
PROPERTY_BENTHOS_TOTAL_WEIGHT,
PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT,
PROPERTY_PLANKTON_TOTAL_WEIGHT,
@@ -85,11 +85,11 @@
protected Float speciesTotalWeight;
- protected Float speciesTotalVracWeight;
+ protected Float speciesTotalSortedWeight;
- protected Float speciesSampleVracWeight;
+ protected Float speciesSampleSortedWeight;
- protected Float speciesTotalHorsVracWeight;
+ protected Float speciesTotalUnsortedWeight;
protected Float benthosTotalWeight;
@@ -127,34 +127,34 @@
firePropertyChange(PROPERTY_SPECIES_TOTAL_WEIGHT, oldValue, speciesTotalWeight);
}
- public Float getSpeciesTotalVracWeight() {
- return speciesTotalVracWeight;
+ public Float getSpeciesTotalSortedWeight() {
+ return speciesTotalSortedWeight;
}
- public void setSpeciesTotalVracWeight(Float speciesTotalVracWeight) {
- Object oldValue = getSpeciesTotalVracWeight();
- this.speciesTotalVracWeight = speciesTotalVracWeight;
- firePropertyChange(PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT, oldValue, speciesTotalVracWeight);
+ public void setSpeciesTotalSortedWeight(Float speciesTotalSortedWeight) {
+ Object oldValue = getSpeciesTotalSortedWeight();
+ this.speciesTotalSortedWeight = speciesTotalSortedWeight;
+ firePropertyChange(PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT, oldValue, speciesTotalSortedWeight);
}
- public Float getSpeciesSampleVracWeight() {
- return speciesSampleVracWeight;
+ public Float getSpeciesSampleSortedWeight() {
+ return speciesSampleSortedWeight;
}
- public void setSpeciesSampleVracWeight(Float speciesSampleVracWeight) {
- Object oldValue = getSpeciesSampleVracWeight();
- this.speciesSampleVracWeight = speciesSampleVracWeight;
- firePropertyChange(PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT, oldValue, speciesSampleVracWeight);
+ public void setSpeciesSampleSortedWeight(Float speciesSampleSortedWeight) {
+ Object oldValue = getSpeciesSampleSortedWeight();
+ this.speciesSampleSortedWeight = speciesSampleSortedWeight;
+ firePropertyChange(PROPERTY_SPECIES_SAMPLE_SORTED_WEIGHT, oldValue, speciesSampleSortedWeight);
}
- public Float getSpeciesTotalHorsVracWeight() {
- return speciesTotalHorsVracWeight;
+ public Float getSpeciesTotalUnsortedWeight() {
+ return speciesTotalUnsortedWeight;
}
- public void setSpeciesTotalHorsVracWeight(Float speciesTotalHorsVracWeight) {
- Object oldValue = getSpeciesTotalHorsVracWeight();
- this.speciesTotalHorsVracWeight = speciesTotalHorsVracWeight;
- firePropertyChange(PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT, oldValue, speciesTotalHorsVracWeight);
+ public void setSpeciesTotalUnsortedWeight(Float speciesTotalUnsortedWeight) {
+ Object oldValue = getSpeciesTotalUnsortedWeight();
+ this.speciesTotalUnsortedWeight = speciesTotalUnsortedWeight;
+ firePropertyChange(PROPERTY_SPECIES_TOTAL_UNSORTED_WEIGHT, oldValue, speciesTotalUnsortedWeight);
}
public Float getBenthosTotalWeight() {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java 2012-12-20 16:08:26 UTC (rev 98)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.ui.swing.content.operation.fishing.gearshooting;
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.AbstractTuttiBeanUIModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUI.jaxx 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUI.jaxx 2012-12-20 16:08:26 UTC (rev 98)
@@ -1,3 +1,26 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
<Table implements='fr.ifremer.tutti.ui.swing.TuttiUI<GearShootingTabUIModel, GearShootingTabUIHandler>'>
<import>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java 2012-12-20 16:08:26 UTC (rev 98)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.ui.swing.content.operation.fishing.gearshooting;
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.content.operation.EditFishingOperationUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java 2012-12-20 16:08:26 UTC (rev 98)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology;
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.AbstractTuttiBeanUIModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.css 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.css 2012-12-20 16:08:26 UTC (rev 98)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
#hydrologyTable {
selectionMode: {ListSelectionModel.SINGLE_SELECTION};
selectionBackground: {null};
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.jaxx 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.jaxx 2012-12-20 16:08:26 UTC (rev 98)
@@ -1,3 +1,26 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
<Table implements='fr.ifremer.tutti.ui.swing.TuttiUI<HydrologyTabUIModel, HydrologyTabUIHandler>'>
<import>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java 2012-12-20 16:08:26 UTC (rev 98)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology;
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.content.operation.EditFishingOperationUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java 2012-12-20 16:08:26 UTC (rev 98)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology;
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.Maps;
import java.util.Map;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css 2012-12-20 16:08:26 UTC (rev 98)
@@ -41,37 +41,37 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#speciesTotalVracWeightLabel {
- text: "tutti.label.catches.speciesTotalVracWeight";
- labelFor: {speciesTotalVracWeightField};
+#speciesTotalSortedWeightLabel {
+ text: "tutti.label.catches.speciesTotalSortedWeight";
+ labelFor: {speciesTotalSortedWeightField};
}
-#speciesTotalVracWeightField {
- property: "speciesTotalVracWeight";
- model: {model.getSpeciesTotalVracWeight()};
+#speciesTotalSortedWeightField {
+ property: "speciesTotalSortedWeight";
+ model: {model.getSpeciesTotalSortedWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#speciesSampleVracWeightLabel {
- text: "tutti.label.catches.speciesSampleVracWeight";
- labelFor: {speciesSampleVracWeightField};
+#speciesSampleSortedWeightLabel {
+ text: "tutti.label.catches.speciesSampleSortedWeight";
+ labelFor: {speciesSampleSortedWeightField};
}
-#speciesSampleVracWeightField {
- property: "speciesSampleVracWeight";
- model: {model.getSpeciesSampleVracWeight()};
+#speciesSampleSortedWeightField {
+ property: "speciesSampleSortedWeight";
+ model: {model.getSpeciesSampleSortedWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#speciesTotalHorsVracWeightLabel {
- text: "tutti.label.catches.speciesTotalHorsVracWeight";
- labelFor: {speciesTotalHorsVracWeightField};
+#speciesTotalUnsortedWeightLabel {
+ text: "tutti.label.catches.speciesTotalUnsortedWeight";
+ labelFor: {speciesTotalUnsortedWeightField};
}
-#speciesTotalHorsVracWeightField {
- text: {getStringValue(model.getSpeciesTotalHorsVracWeight())};
+#speciesTotalUnsortedWeightField {
+ text: {getStringValue(model.getSpeciesTotalUnsortedWeight())};
editable: false;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx 2012-12-20 16:08:26 UTC (rev 98)
@@ -69,12 +69,12 @@
<BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
<field name='speciesTotalWeight' component='speciesTotalWeightField'/>
- <field name='speciesTotalVracWeight'
- component='speciesTotalVracWeightField'/>
- <field name='speciesSampleVracWeight'
- component='speciesSampleVracWeightField'/>
- <field name='speciesTotalHorsVracWeight'
- component='speciesTotalHorsVracWeightField'/>
+ <field name='speciesTotalSortedWeight'
+ component='speciesTotalSortedWeightField'/>
+ <field name='speciesSampleSortedWeight'
+ component='speciesSampleSortedWeightField'/>
+ <field name='speciesTotalUnsortedWeight'
+ component='speciesTotalUnsortedWeightField'/>
</BeanValidator>
<SpeciesFrequencyUI id='frequencyEditor'
@@ -94,10 +94,10 @@
<NumberEditor id='speciesTotalWeightField' constructorParams='this'/>
</cell>
<cell anchor='west'>
- <JLabel id='speciesTotalVracWeightLabel'/>
+ <JLabel id='speciesTotalSortedWeightLabel'/>
</cell>
<cell weightx='1.0'>
- <NumberEditor id='speciesTotalVracWeightField'
+ <NumberEditor id='speciesTotalSortedWeightField'
constructorParams='this'/>
</cell>
</row>
@@ -105,17 +105,17 @@
<!-- Poids échantillonné vrac / Poids total hors vrac -->
<row>
<cell>
- <JLabel id='speciesSampleVracWeightLabel'/>
+ <JLabel id='speciesSampleSortedWeightLabel'/>
</cell>
<cell>
- <NumberEditor id='speciesSampleVracWeightField'
+ <NumberEditor id='speciesSampleSortedWeightField'
constructorParams='this'/>
</cell>
<cell>
- <JLabel id='speciesTotalHorsVracWeightLabel'/>
+ <JLabel id='speciesTotalUnsortedWeightLabel'/>
</cell>
<cell>
- <JTextField id='speciesTotalHorsVracWeightField'/>
+ <JTextField id='speciesTotalUnsortedWeightField'/>
</cell>
</row>
</Table>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java 2012-12-20 16:08:26 UTC (rev 98)
@@ -528,7 +528,6 @@
}
}
}
-
model.setRows(rows);
}
@@ -652,7 +651,8 @@
Float totalVrac = 0f;
for (SpeciesBatchRowModel batch : getModel().getRows()) {
- CaracteristicQualitativeValue vracHorsVrac = batch.getSortedUnsortedCategory();
+ CaracteristicQualitativeValue vracHorsVrac =
+ batch.getSortedUnsortedCategory();
if (vracHorsVrac == null) {
@@ -676,7 +676,7 @@
log.info("New total vrac / hors vrac: " +
totalVrac + " / " + totalHorsVrac);
}
- getModel().setSpeciesTotalHorsVracWeight(totalHorsVrac);
+ getModel().setSpeciesTotalUnsortedWeight(totalHorsVrac);
//TODO Should we also set the total vrac weight ?
// getModel().setTotalVracWeight(totalVrac);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java 2012-12-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java 2012-12-20 16:08:26 UTC (rev 98)
@@ -24,7 +24,6 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
@@ -55,9 +54,9 @@
public SpeciesBatchUIModel(EditCatchesUIModel catchesUIModel) {
super(catchesUIModel,
EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT);
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_UNSORTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_SAMPLE_SORTED_WEIGHT);
this.samplingTreeModel = new SpeciesBatchTreeModel();
}
@@ -69,28 +68,28 @@
catchesUIModel.setSpeciesTotalWeight(speciesTotalWeight);
}
- public Float getSpeciesTotalVracWeight() {
- return catchesUIModel.getSpeciesTotalVracWeight();
+ public Float getSpeciesTotalSortedWeight() {
+ return catchesUIModel.getSpeciesTotalSortedWeight();
}
- public void setSpeciesTotalVracWeight(Float speciesTotalVracWeight) {
- catchesUIModel.setSpeciesTotalVracWeight(speciesTotalVracWeight);
+ public void setSpeciesTotalSortedWeight(Float speciesTotalSortedWeight) {
+ catchesUIModel.setSpeciesTotalSortedWeight(speciesTotalSortedWeight);
}
- public Float getSpeciesSampleVracWeight() {
- return catchesUIModel.getSpeciesSampleVracWeight();
+ public Float getSpeciesSampleSortedWeight() {
+ return catchesUIModel.getSpeciesSampleSortedWeight();
}
- public void setSpeciesSampleVracWeight(Float speciesSampleVracWeight) {
- catchesUIModel.setSpeciesSampleVracWeight(speciesSampleVracWeight);
+ public void setSpeciesSampleSortedWeight(Float speciesSampleSortedWeight) {
+ catchesUIModel.setSpeciesSampleSortedWeight(speciesSampleSortedWeight);
}
- public Float getSpeciesTotalHorsVracWeight() {
- return catchesUIModel.getSpeciesTotalHorsVracWeight();
+ public Float getSpeciesTotalUnsortedWeight() {
+ return catchesUIModel.getSpeciesTotalUnsortedWeight();
}
- public void setSpeciesTotalHorsVracWeight(Float speciesTotalHorsVracWeight) {
- catchesUIModel.setSpeciesTotalHorsVracWeight(speciesTotalHorsVracWeight);
+ public void setSpeciesTotalUnsortedWeight(Float speciesTotalUnsortedWeight) {
+ catchesUIModel.setSpeciesTotalUnsortedWeight(speciesTotalUnsortedWeight);
}
public SpeciesBatchTreeModel getSamplingTreeModel() {
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-20 15:31:40 UTC (rev 97)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-20 16:08:26 UTC (rev 98)
@@ -50,9 +50,9 @@
tutti.label.catches.macroWasteTotalWeight=Poids total
tutti.label.catches.planktonSampleTotalWeight=Poids total échantillonné
tutti.label.catches.planktonTotalWeight=Poids total
-tutti.label.catches.speciesSampleVracWeight=Poids total vrac échantillon
-tutti.label.catches.speciesTotalHorsVracWeight=Poids total hors vrac
-tutti.label.catches.speciesTotalVracWeight=Poids total vrac
+tutti.label.catches.speciesSampleSortedWeight=Poids total vrac échantillon
+tutti.label.catches.speciesTotalSortedWeight=Poids total vrac
+tutti.label.catches.speciesTotalUnsortedWeight=Poids total hors vrac
tutti.label.catches.speciesTotalWeight=Poids total
tutti.label.comment=Commentaire
tutti.label.cruise=Campagne
@@ -123,7 +123,7 @@
tutti.label.program.name=Nom
tutti.label.program.zone=Zone
tutti.label.protocol=Protocol de saisie
-tutti.label.species.speciesTotalHorsVracWeight=
+tutti.label.species.speciesTotalUnsortedWeight=
tutti.label.tab.accidentel=Captures accidentelles
tutti.label.tab.benthos=Benthos
tutti.label.tab.catches=Captures
1
0
r97 - trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence
by kmorin@users.forge.codelutin.com Dec. 20, 2012
by kmorin@users.forge.codelutin.com Dec. 20, 2012
Dec. 20, 2012
Author: kmorin
Date: 2012-12-20 16:31:40 +0100 (Thu, 20 Dec 2012)
New Revision: 97
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/97
Log:
debug caracteristics put twice in the cache
Modified:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.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/TuttiPersistenceDevFixtures.java 2012-12-20 15:02:18 UTC (rev 96)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-12-20 15:31:40 UTC (rev 97)
@@ -247,14 +247,11 @@
createCaracteristicQuantitativeValue(ca, "Coup de vent");
createCaracteristicQuantitativeValue(ca, "Fort coup de vent");
- cache.put(Caracteristic.class, ca);
-
ca = createQuantitativeCaracteristic("Sea State",
CaracteristicEnum.FishingOperationEnvironment.name());
createCaracteristicQuantitativeValue(ca, "Mer calme");
createCaracteristicQuantitativeValue(ca, "Mer agitée");
- cache.put(Caracteristic.class, ca);
createNumberCaracteristic("Wind direction",
CaracteristicEnum.FishingOperationEnvironment.name());
1
0
r96 - in trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence: . spatial
by tchemit@users.forge.codelutin.com Dec. 20, 2012
by tchemit@users.forge.codelutin.com Dec. 20, 2012
Dec. 20, 2012
Author: tchemit
Date: 2012-12-20 16:02:18 +0100 (Thu, 20 Dec 2012)
New Revision: 96
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/96
Log:
refs #1899: Cr?\195?\169er un ?\195?\169diteur de position spatiale (help to convert from sexagecimal to decimal)
Added:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/spatial/
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/spatial/GeoPositionHelper.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/spatial/SexagecimalPosition.java
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/spatial/GeoPositionHelper.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/spatial/GeoPositionHelper.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/spatial/GeoPositionHelper.java 2012-12-20 15:02:18 UTC (rev 96)
@@ -0,0 +1,121 @@
+package fr.ifremer.tutti.persistence.spatial;
+
+/*
+ * #%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%
+ */
+
+/**
+ * Helper about geo position computation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class GeoPositionHelper {
+
+ /**
+ * Calcule le quadrant à partir d'une {@code longitude} et {@code latitude}.
+ *
+ * @param longitude la longitude décimale
+ * @param latitude la latitude décimale
+ * @return la valeur du quadrant ou {@code null} si l'une des deux
+ * coordonnées est {@code null}.
+ * @since 0.3
+ */
+ public static Integer getQuadrant(Float longitude, Float latitude) {
+ if (longitude == null || latitude == null) {
+ return null;
+ }
+ int result;
+
+ if (latitude > 0) {
+ result = longitude > 0 ? 1 : 4;
+ } else {
+ result = longitude > 0 ? 2 : 3;
+ }
+ return result;
+ }
+
+ /**
+ * Calcule la valeur signée de la longitude à partir du {@code quadrant} et
+ * de la valeur absolue de la {@code longitude}.
+ *
+ * @param quadrant la valeur du quandrant (peut être null)
+ * @param longitude la longitude décimale (peut être null)
+ * @return la valeur signée de la longitude ou {@code null} si l'une des
+ * deux données d'entrée est {@code null}.
+ * @since 0.3
+ */
+ public static Float getSignedLongitude(Integer quadrant, Float longitude) {
+ if (longitude == null) {
+ return null;
+ }
+ if (quadrant == null) {
+
+ // cas special ou pas encore de quadrant positionne, on conserve
+ // juste la valeur de la longitude sans rien faire d'autre
+ return longitude;
+ }
+ int result;
+ switch (quadrant) {
+ case 1:
+ case 2:
+ result = 1;
+ break;
+ default:
+ result = -1;
+ }
+ return result * longitude;
+ }
+
+ /**
+ * Calcule la valeur signée de la latitude à partir du {@code quadrant} et
+ * de la valeur absolue de la {@code latitude}.
+ *
+ * @param quadrant la valeur du quandrant (peut être null)
+ * @param latitude la longitude décimale (peut être null)
+ * @return la valeur signée de la latitude ou {@code null} si l'une des
+ * deux données d'entrée est {@code null}.
+ * @since 0.3
+ */
+ public static Float getSignedLatitude(Integer quadrant, Float latitude) {
+ if (latitude == null) {
+ return null;
+ }
+ if (quadrant == null) {
+
+ // cas special ou pas encore de quadrant positionne, on conserve
+ // juste la valeur de la latitude sans rien faire d'autre
+ return latitude;
+ }
+ int result;
+ switch (quadrant) {
+ case 1:
+ case 4:
+ result = 1;
+ break;
+ default:
+ result = -1;
+ }
+ return result * latitude;
+ }
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/spatial/GeoPositionHelper.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/spatial/SexagecimalPosition.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/spatial/SexagecimalPosition.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/spatial/SexagecimalPosition.java 2012-12-20 15:02:18 UTC (rev 96)
@@ -0,0 +1,235 @@
+package fr.ifremer.tutti.persistence.spatial;
+
+/*
+ * #%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 org.apache.commons.lang3.ObjectUtils;
+
+import java.io.Serializable;
+
+/**
+ * Define a geo spatial position coordinate in degre, minute, second.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class SexagecimalPosition implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected boolean sign;
+
+ protected Integer degre;
+
+ protected Integer minute;
+
+ protected Integer seconde;
+
+ /**
+ * Methode statique de fabrique de position a partir d'une valeur du format
+ * decimal.
+ * <p/>
+ * Note : Si la valeur (au format decimal) vaut <code>null</code>, alors on
+ * reinitialise les composants de la position a <code>null</code> et la
+ * methode {@link #isNull()} vaudra alors {@code true}.
+ *
+ * @param decimal la valeur au format decimal
+ * @return une nouvelle instance de position convertie
+ */
+ public static SexagecimalPosition valueOf(Float decimal) {
+ SexagecimalPosition r = new SexagecimalPosition();
+ r.update(decimal);
+ return r;
+ }
+
+ /**
+ * Methode statique de fabrique de position a partir d'une valeur du format
+ * degre-minute-seconde.
+ *
+ * @param d la valeur des degres
+ * @param m la valeur des minutes
+ * @param s la valeur des secondes
+ * @return une nouvelle instance de position convertie
+ */
+ public static SexagecimalPosition valueOf(boolean sign, int d, int m, int s) {
+ SexagecimalPosition r = new SexagecimalPosition();
+ r.setSign(sign);
+ r.setDegre(d);
+ r.setMinute(m);
+ r.setSeconde(s);
+ return r;
+ }
+
+ /**
+ * @return {@code true} si aucune composante n'est renseigné,
+ * {@code false} autrement.
+ */
+ public boolean isNull() {
+ return degre == null && minute == null && seconde == null;
+ }
+
+ /**
+ * Mets a jour les composants de la position a partir d'une valeur decimal.
+ * <p/>
+ * Note : Si la valeur (au format decimal) vaut <code>null</code>, alors on
+ * reinitialise les composants de la position a <code>null</code> et la
+ * methode {@link #isNull()} vaudra alors {@code true}.
+ *
+ * @param decimal la valeur decimale a convertir (qui peut etre nulle).
+ */
+ public void update(Float decimal) {
+ Integer d = null;
+ Integer m = null;
+ Integer s = null;
+ boolean si = false;
+ if (decimal != null) {
+ si = decimal < 0;
+
+ decimal = Math.abs(decimal);
+ int remain = 0;
+
+ d = (int) (Math.round(decimal + 0.5) - 1);
+ m = 0;
+ s = 0;
+ decimal = 60 * (decimal - d);
+ if (decimal > 0) {
+ m = (int) (Math.round(decimal + 0.5) - 1);
+ decimal = 60 * (decimal - m);
+ if (decimal > 0) {
+ s = (int) (Math.round(decimal + 0.5) - 1);
+ remain = (int) (10 * (decimal - s));
+ }
+ }
+ if (remain > 9) {
+ s++;
+ }
+ if (s == 60) {
+ m++;
+ s = 0;
+ }
+ if (m == 60) {
+ d++;
+ m = 0;
+ }
+ }
+ degre = d;
+ minute = m;
+ seconde = s;
+ sign = si;
+ }
+
+ public Float toDecimal() {
+ if (isNull()) {
+ return null;
+ }
+ Integer d = degre == null ? 0 : degre;
+ Integer m = minute == null ? 0 : minute;
+ Integer s = seconde == null ? 0 : seconde;
+ Float result = Float.valueOf(d);
+ if (m > 0) {
+ result += (float) m / 60;
+ if (s == 0) {
+ result += 0.5f / 3600;
+ }
+ }
+ if (s > 0) {
+ result += ((float) s + 0.5f) / 3600;
+ }
+ if (sign) {
+ result *= -1;
+ }
+ return result;
+ }
+
+ public Integer getDegre() {
+ return degre;
+ }
+
+ public Integer getMinute() {
+ return minute;
+ }
+
+ public Integer getSeconde() {
+ return seconde;
+ }
+
+ public boolean isSign() {
+ return sign;
+ }
+
+ public void setDegre(Integer degre) {
+ this.degre = degre;
+ }
+
+ public void setMinute(Integer minute) {
+ this.minute = minute;
+ }
+
+ public void setSeconde(Integer seconde) {
+ this.seconde = seconde;
+ }
+
+ public void setSign(boolean sign) {
+ this.sign = sign;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ SexagecimalPosition other = (SexagecimalPosition) obj;
+ return sign == other.sign &&
+ ObjectUtils.equals(degre, other) &&
+ ObjectUtils.equals(minute, other.minute) &&
+ ObjectUtils.equals(seconde, other.seconde);
+
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + "<" + (sign ? "-" : "") + degre + "° " + minute + "' " + seconde + "''>";
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 5 * (sign ? 1 : 0);
+ hash = 7 * hash + (degre != null ? degre.hashCode() : 0);
+ hash = 11 * hash + (minute != null ? minute.hashCode() : 0);
+ hash = 13 * hash + (seconde != null ? seconde.hashCode() : 0);
+ return hash;
+ }
+
+ protected SexagecimalPosition() {
+ // contructeur non publique, on prefere l'utilisation de la methode
+ // #valueOf()
+ }
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/spatial/SexagecimalPosition.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
Dec. 20, 2012
Author: tchemit
Date: 2012-12-20 15:46:40 +0100 (Thu, 20 Dec 2012)
New Revision: 95
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/95
Log:
fix fishing operation caracteristic map
Modified:
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
1
0
r94 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing/content/operation java/fr/ifremer/tutti/ui/swing/content/operation/accidental java/fr/ifremer/tutti/ui/swing/content/operation/benthos java/fr/ifremer/tutti/ui/swing/content/operation/catches java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste java/fr/ifremer/tutti/ui/swing/content/operation/plankton java/fr/ifremer/tutti/ui/swing/content/operation/species resources/i18n
by tchemit@users.forge.codelutin.com Dec. 20, 2012
by tchemit@users.forge.codelutin.com Dec. 20, 2012
Dec. 20, 2012
Author: tchemit
Date: 2012-12-20 14:30:24 +0100 (Thu, 20 Dec 2012)
New Revision: 94
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/94
Log:
refs #1804: Onglet captures
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.java
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -32,7 +32,7 @@
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
@@ -85,20 +85,10 @@
*/
protected final PersistenceService persistenceService;
- /**
- * To monitor changes on the fishing operation.
- *
- * @since 0.2
- */
- protected final TuttiBeanMonitor<M> fishingOperationMonitor;
-
- protected AbstractTuttiBatchTableUIHandler(FishingOperationsUI parentUi,
- String[] fishingProperties,
+ protected AbstractTuttiBatchTableUIHandler(TuttiUI<?,?> parentUi,
String... properties) {
super(parentUi.getHandler().getContext(), properties);
this.persistenceService = context.getService(PersistenceService.class);
- this.fishingOperationMonitor = new TuttiBeanMonitor<M>(
- fishingProperties);
}
public final void saveSelectedRowIfRequired(FocusEvent event) {
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -0,0 +1,79 @@
+package fr.ifremer.tutti.ui.swing.content.operation;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Set;
+
+/**
+ * Abstract model for ui in batch tabs.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class AbstractTuttiBatchUIModel<R extends AbstractTuttiBeanUIModel, B extends AbstractTuttiBatchUIModel<R, B>> extends AbstractTuttiTableUIModel<FishingOperation, R, B> {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Fishing Operation to prapagate to catches model.
+ *
+ * @since 0.3
+ */
+ protected final Set<String> propagateProperties;
+
+ /**
+ * Editing fishing catches model.
+ *
+ * @since 0.3
+ */
+ protected final EditCatchesUIModel catchesUIModel;
+
+ protected AbstractTuttiBatchUIModel(EditCatchesUIModel catchesUIModel,
+ String... properties) {
+ super(FishingOperation.class, null, null);
+ this.catchesUIModel = catchesUIModel;
+ propagateProperties = Sets.newHashSet(properties);
+ catchesUIModel.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (propagateProperties.contains(evt.getPropertyName())) {
+ firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
+ }
+ }
+ });
+ }
+
+ public final FishingOperation getFishingOperation() {
+ return catchesUIModel == null ? null : catchesUIModel.getFishingOperation();
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2012-12-20 13:30:24 UTC (rev 94)
@@ -63,8 +63,6 @@
handler.beforeInitUI();
}
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
@@ -268,8 +266,6 @@
<row>
<cell columns='6'>
<JPanel layout='{new GridLayout(1,0)}'>
- <JButton id='importPupitriButton'
- onActionPerformed='handler.importPupitri()'/>
<JButton id='importCasinoButton'
onActionPerformed='handler.importCasino()'/>
</JPanel>
@@ -279,13 +275,6 @@
<!-- Saisisseur -->
<row weighty='0.3'>
<cell columns='6'>
- <!-- <JScrollPane id='saisisseurPane'
- columnHeaderView="{saisisseurHeader}"
- onFocusGained='saisisseurList.requestFocus()'>
- <JList id='saisisseurList'
- onValueChanged='handler.selectListData(event, "saisisseur")'/>
- <BeanListHeader id='saisisseurHeader' genericType='Person'/>
- </JScrollPane>-->
<BeanDoubleList id='saisisseurList' genericType='Person'/>
</cell>
</row>
@@ -307,14 +296,12 @@
title='tutti.label.tab.fishingOperation.gearShooting'>
<GearShootingTabUI id='gearShootingTabContent' constructorParams='this'/>
-
</tab>
<tab id='environmentTab'
title='tutti.label.tab.fishingOperation.environment'>
<EnvironmentTabUI id='environmentTabContent' constructorParams='this'/>
-
</tab>
<tab id='traitHydrologyTabContent'
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -329,12 +329,29 @@
if (empty) {
- model.fromBean(new FishingOperation());
- } else {
+ bean = new FishingOperation();
+ }
- model.fromBean(bean);
+ FishingOperationLocation strata = bean.getStrata();
+ FishingOperationLocation subStrata = bean.getSubStrata();
+ FishingOperationLocation location = bean.getLocation();
+
+ model.fromBean(bean);
+
+ if (strata != null) {
+ ui.getStrataComboBox().setSelectedItem(strata);
}
+ if (subStrata != null) {
+ ui.getSubStrataComboBox().setSelectedItem(subStrata);
+ }
+
+ if (location != null) {
+ ui.getLocationComboBox().setSelectedItem(location);
+ }
+
+ model.setFishingOperation(bean);
+
// update saisissuer selection
List<Person> saisisseur = model.getSaisisseur();
ui.getSaisisseurList().getModel().setSelected(saisisseur);
@@ -386,6 +403,7 @@
public void save() {
// get fishingOperation to save
+
FishingOperation toSave = getModel().toBean();
if (log.isInfoEnabled()) {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -144,11 +144,13 @@
protected String comment;
protected List<Person> saisisseur;
-
+
protected Map<Object, Object> gearShootingParameters;
-
+
protected Map<Object, Object> environmentParameters;
+ protected FishingOperation fishingOperation;
+
protected Map<Object, Object> hydrologyParameters;
protected static Binder<EditFishingOperationUIModel, FishingOperation> toBeanBinder =
@@ -162,6 +164,14 @@
super(FishingOperation.class, fromBeanBinder, toBeanBinder);
}
+ public FishingOperation getFishingOperation() {
+ return fishingOperation;
+ }
+
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ this.fishingOperation = fishingOperation;
+ }
+
public boolean isEmpty() {
return empty;
}
@@ -359,6 +369,11 @@
firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur);
}
+ @Override
+ protected FishingOperation newEntity() {
+ return fishingOperation;
+ }
+
public Map<Object, Object> getGearShootingParameters() {
return gearShootingParameters;
}
@@ -378,11 +393,11 @@
this.environmentParameters = environmentParameters;
firePropertyChange(PROPERTY_ENVIRONMENT_PARAMETERS, oldValue, environmentParameters);
}
-
+
public Map<Object, Object> getHydrologyParameters() {
return hydrologyParameters;
}
-
+
public void setHydrologyParameters(Map<Object, Object> hydrologyParameters) {
Object oldValue = getHydrologyParameters();
this.hydrologyParameters = hydrologyParameters;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2012-12-20 13:30:24 UTC (rev 94)
@@ -41,28 +41,3 @@
#catchesTab {
enabled: {model.getSelectedFishingOperation() != null};
}
-
-#speciesTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#benthosTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#planktonTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#macroDechetTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#accidentelTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#observationIndividuelTab {
- enabled: {false};
- /*enabled: {model.getSelectedFishingOperation() != null};*/
-}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-20 13:30:24 UTC (rev 94)
@@ -28,11 +28,6 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.accidental.AccidentalBatchUI
- fr.ifremer.tutti.ui.swing.content.operation.benthos.BenthosBatchUI
- fr.ifremer.tutti.ui.swing.content.operation.macrowaste.MacroWasteBatchUI
- fr.ifremer.tutti.ui.swing.content.operation.plankton.PlanktonBatchUI
- fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchUI
fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI
jaxx.runtime.swing.editor.bean.BeanComboBox
@@ -80,24 +75,6 @@
<tab id='catchesTab' title='tutti.label.tab.catches'>
<EditCatchesUI id='catchesTabContent' constructorParams='this'/>
</tab>
- <tab id='speciesTab' title='tutti.label.tab.species'>
- <SpeciesBatchUI id='speciesTabContent' constructorParams='this'/>
- </tab>
- <tab id='benthosTab' title='tutti.label.tab.benthos'>
- <BenthosBatchUI id='benthosTabContent' constructorParams='this'/>
- </tab>
- <tab id='planktonTab' title='tutti.label.tab.plancton'>
- <PlanktonBatchUI id='planktonTabContent' constructorParams='this'/>
- </tab>
- <tab id='macroDechetTab' title='tutti.label.tab.macroDechet'>
- <MacroWasteBatchUI id='macroDechetTabContent' constructorParams='this'/>
- </tab>
- <tab id='accidentelTab' title='tutti.label.tab.accidentel'>
- <AccidentalBatchUI id='accidentelTabContent' constructorParams='this'/>
- </tab>
- <tab id='observationIndividuelTab' title='tutti.label.tab.observationIndividuel'>
- <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
- </tab>
</JTabbedPane>
</JPanel>
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -30,9 +30,11 @@
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.decorator.Decorator;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -41,6 +43,8 @@
import java.util.Date;
import java.util.List;
+import static org.nuiton.i18n.I18n._;
+
/**
* Handler of UI {@link FishingOperationsUI}.
*
@@ -72,6 +76,8 @@
}
FishingOperationsUIModel model = new FishingOperationsUIModel();
+ EditCatchesUIModel catchesUIModel = new EditCatchesUIModel();
+
String cruiseId = context.getCruiseId();
// load existing cruise
@@ -88,6 +94,7 @@
}
ui.setContextValue(model);
+ ui.setContextValue(catchesUIModel);
}
@Override
@@ -176,15 +183,28 @@
public void stateChanged(ChangeEvent e) {
}
});
+
+ String fishingOperationText;
+
+ if (fishingOperation == null) {
+ fishingOperationText = "";
+ } else {
+ Decorator<FishingOperation> decorator =
+ getDecorator(FishingOperation.class, null);
+
+ fishingOperationText =
+ _("tutti.label.traitReminder",
+ decorator.toString(fishingOperation));
+ }
+
// propagate fishingOperation to his tabs
- ui.getFishingOperationTabContent().selectFishingOperation(fishingOperation);
- ui.getCatchesTabContent().selectFishingOperation(fishingOperation);
- ui.getSpeciesTabContent().selectFishingOperation(fishingOperation);
- ui.getBenthosTabContent().selectFishingOperation(fishingOperation);
- ui.getPlanktonTabContent().selectFishingOperation(fishingOperation);
- ui.getMacroDechetTabContent().selectFishingOperation(fishingOperation);
- ui.getAccidentelTabContent().selectFishingOperation(fishingOperation);
+ ui.getFishingOperationTabContent().getHandler().selectFishingOperation(fishingOperation
+ );
+ ui.getCatchesTabContent().getHandler().selectFishingOperation(fishingOperation,
+ fishingOperationText);
+
+
// repaint tabs
ui.getTabPane().repaint();
// ui.getObservationIndividuelTabContent().selectFishingOperation(selectedFishingOperation);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx 2012-12-20 13:30:24 UTC (rev 94)
@@ -25,10 +25,9 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<AccidentalBatchUIModel, AccidentalBatchUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
-
+ fr.ifremer.tutti.ui.swing.TuttiUI
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
@@ -45,31 +44,26 @@
<script><![CDATA[
-public AccidentalBatchUI(FishingOperationsUI parentUI) {
+public AccidentalBatchUI(TuttiUI<?,?> parentUI) {
+ JAXXUtil.initContext(this, parentUI);
AccidentalBatchUIHandler handler = new AccidentalBatchUIHandler(parentUI, this);
setContextValue(handler);
handler.beforeInitUI();
}
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
<AccidentalBatchUIHandler id='handler'
- initializer='getContextValue(AccidentalBatchUIHandler.class)'/>
+ initializer='getContextValue(AccidentalBatchUIHandler.class)'/>
<AccidentalBatchUIModel id='model'
- initializer='getContextValue(AccidentalBatchUIModel.class)'/>
+ initializer='getContextValue(AccidentalBatchUIModel.class)'/>
<LongTextEditorUI id='longTextEditor'/>
<AttachmentEditorUI id='attachmentEditor'/>
- <JPanel constraints='BorderLayout.NORTH' layout='{new BorderLayout()}'>
- <JLabel id='fishingOperationReminderLabel'
- constraints='BorderLayout.NORTH'/>
- <JSeparator constraints='BorderLayout.CENTER'/>
- </JPanel>
+
<JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
<JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event)'/>
</JScrollPane>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -33,11 +33,10 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
-import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
@@ -47,7 +46,6 @@
import javax.swing.table.TableColumnModel;
import java.util.List;
-import static org.nuiton.i18n.I18n._;
import static org.nuiton.i18n.I18n.n_;
/**
@@ -67,9 +65,9 @@
*/
private final AccidentalBatchUI ui;
- public AccidentalBatchUIHandler(FishingOperationsUI parentUi,
+ public AccidentalBatchUIHandler(TuttiUI<?, ?> parentUi,
AccidentalBatchUI ui) {
- super(parentUi, ArrayUtils.EMPTY_STRING_ARRAY,
+ super(parentUi,
AccidentalBatchRowModel.PROPERTY_SPECIES,
AccidentalBatchRowModel.PROPERTY_WEIGHT,
AccidentalBatchRowModel.PROPERTY_COMMENT);
@@ -277,21 +275,6 @@
table.editingCanceled(null);
}
- if (fishingOperationMonitor.wasModified()) {
-
- // previous fishingOperation was modified, let's save it
- AccidentalBatchUIModel beanToSave = fishingOperationMonitor.getBean();
-
- FishingOperation fishingOperation = beanToSave.toBean();
-
- if (log.isInfoEnabled()) {
- log.info("FishingOperation " + fishingOperation.getId() +
- " was modified, will save it.");
- }
-
- persistenceService.saveFishingOperation(fishingOperation);
- }
-
// make sure selection is empty (will remove bean from monitor)
table.clearSelection();
@@ -301,24 +284,13 @@
List<AccidentalBatchRowModel> rows;
- String fishingoperationText;
-
if (empty) {
rows = null;
- bean = new FishingOperation();
- model.setFishingOperation(null);
- fishingoperationText = "";
} else {
- Decorator<FishingOperation> decorator =
- getDecorator(FishingOperation.class, null);
-
- fishingoperationText =
- _("tutti.label.traitReminder", decorator.toString(bean));
-
if (log.isInfoEnabled()) {
- log.info("Get species batch for fishingOperation: " +
- bean.getId() + " - " + fishingoperationText);
+ log.info("Get accidental batch for fishingOperation: " +
+ bean.getId());
}
rows = Lists.newArrayList();
@@ -331,15 +303,9 @@
rows.add(entry);
}
}
- model.setFishingOperation(bean);
- }
- model.fromBean(bean);
+ }
model.setRows(rows);
-
- fishingOperationMonitor.clearModified();
-
- ui.getFishingOperationReminderLabel().setText(fishingoperationText);
}
//------------------------------------------------------------------------//
@@ -353,10 +319,11 @@
log.info("beforeInit: " + ui);
}
- AccidentalBatchUIModel model = new AccidentalBatchUIModel();
- ui.setContextValue(model);
+ EditCatchesUIModel catchesUIModel =
+ ui.getContextValue(EditCatchesUIModel.class);
- fishingOperationMonitor.setBean(model);
+ AccidentalBatchUIModel model = new AccidentalBatchUIModel(catchesUIModel);
+ ui.setContextValue(model);
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -24,50 +24,19 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderModelBuilder;
+import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class AccidentalBatchUIModel extends AbstractTuttiTableUIModel<FishingOperation, AccidentalBatchRowModel, AccidentalBatchUIModel> {
+public class AccidentalBatchUIModel extends AbstractTuttiBatchUIModel<AccidentalBatchRowModel, AccidentalBatchUIModel> {
private static final long serialVersionUID = 1L;
- /**
- * Editing fishing operation.
- *
- * @since 0.2
- */
- protected FishingOperation fishingOperation;
-
-
- protected static final Binder<FishingOperation, AccidentalBatchUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, AccidentalBatchUIModel.class)
- .addProperty(FishingOperation.PROPERTY_ID, PROPERTY_ID)
- .toBinder();
-
- protected static final Binder<AccidentalBatchUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(AccidentalBatchUIModel.class, FishingOperation.class)
- .toBinder();
-
-
- public AccidentalBatchUIModel() {
- super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ public AccidentalBatchUIModel(EditCatchesUIModel catchesUIModel) {
+ super(catchesUIModel);
}
- public FishingOperation getFishingOperation() {
- return fishingOperation;
- }
-
- public void setFishingOperation(FishingOperation fishingOperation) {
- this.fishingOperation = fishingOperation;
- }
-
-
- @Override
- protected FishingOperation newEntity() {
- return fishingOperation;
- }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css 2012-12-20 13:30:24 UTC (rev 94)
@@ -29,26 +29,26 @@
showReset: true;
}
-#totalWeightLabel {
- text: "tutti.label.benthos.totalWeight";
- labelFor: {totalWeightField};
+#benthosTotalWeightLabel {
+ text: "tutti.label.catches.benthosTotalWeight";
+ labelFor: {benthosTotalWeightField};
}
-#totalWeightField {
- property: "totalWeight";
- model: {model.getTotalWeight()};
+#benthosTotalWeightField {
+ property: "benthosTotalWeight";
+ model: {model.getBenthosTotalWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#sampleTotalWeightLabel {
- text: "tutti.label.benthos.sampleTotalWeight";
- labelFor: {sampleTotalWeightField};
+#benthosSampleTotalWeightLabel {
+ text: "tutti.label.catches.benthosSampleTotalWeight";
+ labelFor: {benthosSampleTotalWeightField};
}
-#sampleTotalWeightField {
- property: "sampleTotalWeight";
- model: {model.getSampleTotalWeight()};
+#benthosSampleTotalWeightField {
+ property: "benthosSampleTotalWeight";
+ model: {model.getBenthosSampleTotalWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx 2012-12-20 13:30:24 UTC (rev 94)
@@ -25,10 +25,9 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<BenthosBatchUIModel, BenthosBatchUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
-
+ fr.ifremer.tutti.ui.swing.TuttiUI
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
@@ -48,14 +47,13 @@
<script><![CDATA[
-public BenthosBatchUI(FishingOperationsUI parentUI) {
+public BenthosBatchUI(TuttiUI<?,?> parentUI) {
+ JAXXUtil.initContext(this, parentUI);
BenthosBatchUIHandler handler = new BenthosBatchUIHandler(parentUI, this);
setContextValue(handler);
handler.beforeInitUI();
}
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
@@ -69,43 +67,39 @@
<BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ <field name='benthosTotalWeight' component='benthosTotalWeightField'/>
+ <field name='benthosSampleTotalWeight'
+ component='benthosSampleTotalWeightField'/>
</BeanValidator>
<LongTextEditorUI id='longTextEditor'/>
<AttachmentEditorUI id='attachmentEditor'/>
- <JPanel constraints='BorderLayout.NORTH' layout='{new BorderLayout()}'>
- <JLabel id='fishingOperationReminderLabel'
- constraints='BorderLayout.NORTH'/>
- <JSeparator constraints='BorderLayout.CENTER'/>
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
- <Table id='form' fill='both' constraints='BorderLayout.SOUTH'>
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='benthosTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='benthosTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
- <!-- 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='benthosSampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='benthosSampleTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </JPanel>
-
<JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
<JXTable id='table'
onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -33,7 +33,7 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
@@ -46,7 +46,6 @@
import javax.swing.table.TableColumnModel;
import java.util.List;
-import static org.nuiton.i18n.I18n._;
import static org.nuiton.i18n.I18n.n_;
/**
@@ -66,11 +65,9 @@
*/
private final BenthosBatchUI ui;
- public BenthosBatchUIHandler(FishingOperationsUI parentUi,
+ public BenthosBatchUIHandler(TuttiUI<?, ?> parentUi,
BenthosBatchUI ui) {
super(parentUi,
- new String[]{BenthosBatchUIModel.PROPERTY_TOTAL_WEIGHT,
- BenthosBatchUIModel.PROPERTY_SAMPLE_TOTAL_WEIGHT},
BenthosBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
BenthosBatchRowModel.PROPERTY_SPECIES,
BenthosBatchRowModel.PROPERTY_WEIGHT,
@@ -307,21 +304,6 @@
table.editingCanceled(null);
}
- if (fishingOperationMonitor.wasModified()) {
-
- // previous fishingOperation was modified, let's save it
- BenthosBatchUIModel beanToSave = fishingOperationMonitor.getBean();
-
- FishingOperation fishingOperation = beanToSave.toBean();
-
- if (log.isInfoEnabled()) {
- log.info("FishingOperation " + fishingOperation.getId() +
- " was modified, will save it.");
- }
-
- persistenceService.saveFishingOperation(fishingOperation);
- }
-
// make sure selection is empty (will remove bean from monitor)
table.clearSelection();
@@ -331,24 +313,13 @@
List<BenthosBatchRowModel> rows;
- String fishingoperationText;
-
if (empty) {
rows = null;
- bean = new FishingOperation();
- model.setFishingOperation(null);
- fishingoperationText = "";
} else {
- Decorator<FishingOperation> decorator =
- getDecorator(FishingOperation.class, null);
-
- fishingoperationText =
- _("tutti.label.traitReminder", decorator.toString(bean));
-
if (log.isInfoEnabled()) {
log.info("Get species batch for fishingOperation: " +
- bean.getId() + " - " + fishingoperationText);
+ bean.getId());
}
rows = Lists.newArrayList();
@@ -361,15 +332,9 @@
rows.add(entry);
}
}
- model.setFishingOperation(bean);
}
- model.fromBean(bean);
model.setRows(rows);
-
- fishingOperationMonitor.clearModified();
-
- ui.getFishingOperationReminderLabel().setText(fishingoperationText);
}
@@ -384,10 +349,13 @@
log.info("beforeInit: " + ui);
}
- BenthosBatchUIModel model = new BenthosBatchUIModel();
+ EditCatchesUIModel catchesUIModel =
+ ui.getContextValue(EditCatchesUIModel.class);
+
+ BenthosBatchUIModel model = new BenthosBatchUIModel(catchesUIModel);
ui.setContextValue(model);
- fishingOperationMonitor.setBean(model);
+// fishingOperationMonitor.setBean(model);
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -24,90 +24,36 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderModelBuilder;
+import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class BenthosBatchUIModel extends AbstractTuttiTableUIModel<FishingOperation, BenthosBatchRowModel, BenthosBatchUIModel> {
+public class BenthosBatchUIModel extends AbstractTuttiBatchUIModel<BenthosBatchRowModel, BenthosBatchUIModel> {
private static final long serialVersionUID = 1L;
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- /**
- * Editing fishing operation.
- *
- * @since 0.2
- */
- protected FishingOperation fishingOperation;
-
- /**
- * Total Weight filled in screen.
- *
- * @since 0.2
- */
- protected Float totalWeight;
-
- /**
- * Total Sample Weight filled in screen.
- *
- * @since 0.2
- */
- protected Float sampleTotalWeight;
-
- protected static final Binder<FishingOperation, BenthosBatchUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, BenthosBatchUIModel.class)
- .addProperty(FishingOperation.PROPERTY_BENTHOS_TOTAL_WEIGHT, PROPERTY_TOTAL_WEIGHT)
- .addProperty(FishingOperation.PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT, PROPERTY_SAMPLE_TOTAL_WEIGHT)
- .addProperty(FishingOperation.PROPERTY_ID, PROPERTY_ID)
- .toBinder();
-
- protected static final Binder<BenthosBatchUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(BenthosBatchUIModel.class, FishingOperation.class)
- .addProperty(PROPERTY_TOTAL_WEIGHT, FishingOperation.PROPERTY_BENTHOS_TOTAL_WEIGHT)
- .addProperty(PROPERTY_SAMPLE_TOTAL_WEIGHT, FishingOperation.PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT)
- .toBinder();
-
-
- public BenthosBatchUIModel() {
- super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ public BenthosBatchUIModel(EditCatchesUIModel catchesUIModel) {
+ super(catchesUIModel,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT);
}
- public FishingOperation getFishingOperation() {
- return fishingOperation;
+ public Float getBenthosTotalWeight() {
+ return catchesUIModel.getBenthosTotalWeight();
}
- public void setFishingOperation(FishingOperation fishingOperation) {
- this.fishingOperation = fishingOperation;
+ public void setBenthosTotalWeight(Float benthosTotalWeight) {
+ catchesUIModel.setBenthosTotalWeight(benthosTotalWeight);
}
- public Float getTotalWeight() {
- return totalWeight;
+ public Float getBenthosSampleTotalWeight() {
+ return catchesUIModel.getBenthosSampleTotalWeight();
}
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ public void setBenthosSampleTotalWeight(Float benthosSampleTotalWeight) {
+ catchesUIModel.setBenthosSampleTotalWeight(benthosSampleTotalWeight);
}
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- @Override
- protected FishingOperation newEntity() {
- return fishingOperation;
- }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2012-12-20 13:30:24 UTC (rev 94)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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()};
@@ -6,8 +29,28 @@
showReset: true;
}
+#speciesTable {
+ border: {BorderFactory.createTitledBorder(_("tutti.legend.speciesCatches"))};
+}
+
+#benthosTable {
+ border: {BorderFactory.createTitledBorder(_("tutti.legend.benthosCatches"))};
+}
+
+#planktonTable {
+ border: {BorderFactory.createTitledBorder(_("tutti.legend.planktonCatches"))};
+}
+
+#macroWasteTable {
+ border: {BorderFactory.createTitledBorder(_("tutti.legend.macroWasteCatches"))};
+}
+
+#accidentalTable {
+ border: {BorderFactory.createTitledBorder(_("tutti.legend.accidentalCatches"))};
+}
+
#speciesTotalWeightLabel {
- text: "tutti.label.species.speciesTotalWeight";
+ text: "tutti.label.catches.speciesTotalWeight";
labelFor: {speciesTotalWeightField};
}
@@ -19,7 +62,7 @@
}
#speciesTotalVracWeightLabel {
- text: "tutti.label.species.speciesTotalVracWeight";
+ text: "tutti.label.catches.speciesTotalVracWeight";
labelFor: {speciesTotalVracWeightField};
}
@@ -31,7 +74,7 @@
}
#speciesSampleVracWeightLabel {
- text: "tutti.label.species.speciesSampleVracWeight";
+ text: "tutti.label.catches.speciesSampleVracWeight";
labelFor: {speciesSampleVracWeightField};
}
@@ -43,7 +86,7 @@
}
#speciesTotalHorsVracWeightLabel {
- text: "tutti.label.species.speciesTotalHorsVracWeight";
+ text: "tutti.label.catches.speciesTotalHorsVracWeight";
labelFor: {speciesTotalHorsVracWeightField};
}
@@ -53,7 +96,7 @@
}
#benthosTotalWeightLabel {
- text: "tutti.label.benthos.benthosTotalWeight";
+ text: "tutti.label.catches.benthosTotalWeight";
labelFor: {benthosTotalWeightField};
}
@@ -65,7 +108,7 @@
}
#benthosSampleTotalWeightLabel {
- text: "tutti.label.benthos.benthosSampleTotalWeight";
+ text: "tutti.label.catches.benthosSampleTotalWeight";
labelFor: {benthosSampleTotalWeightField};
}
@@ -77,7 +120,7 @@
}
#planktonTotalWeightLabel {
- text: "tutti.label.plankton.planktontotalWeight";
+ text: "tutti.label.catches.planktonTotalWeight";
labelFor: {planktonTotalWeightField};
}
@@ -89,7 +132,7 @@
}
#planktonSampleTotalWeightLabel {
- text: "tutti.label.plankton.planktonSampleTotalWeight";
+ text: "tutti.label.catches.planktonSampleTotalWeight";
labelFor: {planktonSampleTotalWeightField};
}
@@ -101,7 +144,7 @@
}
#macroWasteTotalWeightLabel {
- text: "tutti.label.macroWaste.macroWasteTotalWeight";
+ text: "tutti.label.catches.macroWasteTotalWeight";
labelFor: {macroWasteTotalWeightField};
}
@@ -111,3 +154,12 @@
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
+
+#importPupitriButton {
+ actionIcon: "pupitri-import";
+ text: "tutti.action.pupitri-import";
+}
+
+#observationIndividuelTab {
+ enabled: {false};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2012-12-20 13:30:24 UTC (rev 94)
@@ -1,3 +1,26 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a 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<EditCatchesUIModel, EditCatchesUIHandler>'>
@@ -2,11 +25,16 @@
<import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
- fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesFrequencyUI
+ fr.ifremer.tutti.ui.swing.content.operation.accidental.AccidentalBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.benthos.BenthosBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.macrowaste.MacroWasteBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.plankton.PlanktonBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI
fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
org.jdesktop.swingx.JXTable
+ org.jdesktop.swingx.JXTitledPanel
@@ -28,71 +56,212 @@
<script><![CDATA[
public EditCatchesUI(FishingOperationsUI parentUI) {
+ JAXXUtil.initContext(this, parentUI);
EditCatchesUIHandler handler = new EditCatchesUIHandler(parentUI, this);
setContextValue(handler);
handler.beforeInitUI();
}
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
<EditCatchesUIHandler id='handler'
- initializer='getContextValue(EditCatchesUIHandler.class)'/>
+ initializer='getContextValue(EditCatchesUIHandler.class)'/>
<EditCatchesUIModel id='model'
- initializer='getContextValue(EditCatchesUIModel.class)'/>
+ initializer='getContextValue(EditCatchesUIModel.class)'/>
<SwingValidatorMessageTableModel id='errorTableModel'/>
<BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='speciesTotalWeight' component='speciesTotalWeightField'/>
- <field name='speciesTotalVracWeight' component='speciesTotalVracWeightField'/>
- <field name='speciesSampleVracWeight' component='speciesSampleVracWeightField'/>
- <field name='speciesTotalHorsVracWeight' component='speciesTotalHorsVracWeightField'/>
+ <field name='speciesTotalWeight'
+ component='speciesTotalWeightField'/>
+ <field name='speciesTotalVracWeight'
+ component='speciesTotalVracWeightField'/>
+ <field name='speciesSampleVracWeight'
+ component='speciesSampleVracWeightField'/>
+ <field name='speciesTotalHorsVracWeight'
+ component='speciesTotalHorsVracWeightField'/>
+ <field name='benthosTotalWeight'
+ component='benthosTotalWeightField'/>
+ <field name='benthosSampleTotalWeight'
+ component='benthosSampleTotalWeightField'/>
+ <field name='planktonTotalWeight'
+ component='planktonTotalWeightField'/>
+ <field name='planktonSampleTotalWeight'
+ component='planktonSampleTotalWeightField'/>
+ <field name='macroWasteTotalWeight'
+ component='macroWasteTotalWeightField'/>
</BeanValidator>
- <JPanel constraints='BorderLayout.NORTH' layout='{new BorderLayout()}'>
- <JLabel id='fishingOperationReminderLabel'
- constraints='BorderLayout.NORTH'/>
- <JSeparator constraints='BorderLayout.CENTER'/>
+ <JTabbedPane id='tabPane' constraints='BorderLayout.CENTER'>
+ <tab id='catchesCaracteristicsTab'
+ title='tutti.label.tab.catchesCaracteristics'>
+ <JXTitledPanel id='catchesTabsFishingOperationReminderLabel'>
+ <Table id="catchesForm" fill='both' weightx='1'>
+ <row>
+ <cell>
+ <Table id='speciesTable' fill='both'>
- <Table id='form' fill='both' constraints='BorderLayout.SOUTH'>
+ <!-- Poids total / Poids total vrac -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='speciesTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='speciesTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='speciesTotalVracWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='speciesTotalVracWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
- <!-- Poids total / Poids total vrac -->
- <row>
- <cell anchor='west'>
- <JLabel id='speciesTotalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='speciesTotalWeightField' constructorParams='this'/>
- </cell>
- <cell anchor='west'>
- <JLabel id='speciesTotalVracWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='speciesTotalVracWeightField' constructorParams='this'/>
- </cell>
- </row>
+ <!-- Poids échantillonné vrac / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='speciesSampleVracWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='speciesSampleVracWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='speciesTotalHorsVracWeightLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='speciesTotalHorsVracWeightField'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <Table id='benthosTable' fill='both'>
- <!-- Poids échantillonné vrac / Poids total hors vrac -->
- <row>
- <cell>
- <JLabel id='speciesSampleVracWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='speciesSampleVracWeightField' constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='speciesTotalHorsVracWeightLabel'/>
- </cell>
- <cell>
- <JTextField id='speciesTotalHorsVracWeightField'/>
- </cell>
- </row>
- </Table>
- </JPanel>
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='benthosTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='benthosTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='benthosSampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='benthosSampleTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <Table id='planktonTable' fill='both'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='planktonTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='planktonTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='planktonSampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='planktonSampleTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <Table id='macroWasteTable' fill='both'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='macroWasteTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='macroWasteTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell>
+
+ </cell>
+ </row>
+ <!-- Actions d'import -->
+ <row>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='importPupitriButton'
+ onActionPerformed='handler.importPupitri()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+ </JXTitledPanel>
+ </tab>
+ <tab id='speciesTab' title='tutti.label.tab.species'>
+ <JXTitledPanel id='speciesTabFishingOperationReminderLabel'>
+ <SpeciesBatchUI id='speciesTabContent' constructorParams='this'/>
+ </JXTitledPanel>
+ </tab>
+ <tab id='benthosTab' title='tutti.label.tab.benthos'>
+ <JXTitledPanel id='benthosTabFishingOperationReminderLabel'>
+ <BenthosBatchUI id='benthosTabContent' constructorParams='this'/>
+ </JXTitledPanel>
+ </tab>
+ <tab id='planktonTab' title='tutti.label.tab.plancton'>
+ <JXTitledPanel id='planktonTabFishingOperationReminderLabel'>
+ <PlanktonBatchUI id='planktonTabContent' constructorParams='this'/>
+ </JXTitledPanel>
+ </tab>
+ <tab id='macroWasteTab' title='tutti.label.tab.macroDechet'>
+ <JXTitledPanel id='macroWasteTabFishingOperationReminderLabel'>
+ <MacroWasteBatchUI id='macroWasteTabContent' constructorParams='this'/>
+ </JXTitledPanel>
+ </tab>
+ <tab id='accidentalTab' title='tutti.label.tab.accidentel'>
+ <JXTitledPanel id='accidentalTabFishingOperationReminderLabel'>
+ <AccidentalBatchUI id='accidentalTabContent' constructorParams='this'/>
+ </JXTitledPanel>
+ </tab>
+ <tab id='observationIndividuelTab'
+ title='tutti.label.tab.observationIndividuel'>
+ <JXTitledPanel id='observationTabFishingOperationReminderLabel'>
+ <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
+ </JXTitledPanel>
+ </tab>
+ </JTabbedPane>
+
</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -1,17 +1,37 @@
package fr.ifremer.tutti.ui.swing.content.operation.catches;
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.util.decorator.Decorator;
-import static org.nuiton.i18n.I18n._;
-
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
@@ -22,23 +42,30 @@
private static final Log log =
LogFactory.getLog(EditCatchesUIHandler.class);
+ /**
+ * UI.
+ *
+ * @since 0.3
+ */
private final EditCatchesUI ui;
- private final FishingOperationsUI parentUi;
-
+ /**
+ * Persistence service.
+ *
+ * @since 0.3
+ */
private final PersistenceService persistenceService;
/**
- * To monitor changes on the fishing operation.
+ * To monitor changes on the incoming fishing operation.
*
- * @since 0.2
+ * @since 0.3
*/
private final TuttiBeanMonitor<EditCatchesUIModel> fishingOperationMonitor;
public EditCatchesUIHandler(FishingOperationsUI parentUi, EditCatchesUI ui) {
super(parentUi.getHandler().getContext());
this.ui = ui;
- this.parentUi = parentUi;
this.persistenceService = context.getService(PersistenceService.class);
this.fishingOperationMonitor = new TuttiBeanMonitor<EditCatchesUIModel>(
EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_WEIGHT,
@@ -49,19 +76,16 @@
EditCatchesUIModel.PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT,
EditCatchesUIModel.PROPERTY_PLANKTON_TOTAL_WEIGHT,
EditCatchesUIModel.PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT,
- EditCatchesUIModel.PROPERTY_MACRO_WASTE_TOTAL_WEIGHT
- );
+ EditCatchesUIModel.PROPERTY_MACRO_WASTE_TOTAL_WEIGHT);
}
@Override
public void beforeInitUI() {
- EditCatchesUIModel model = new EditCatchesUIModel();
+ EditCatchesUIModel model = ui.getContextValue(EditCatchesUIModel.class);
listModelIsModify(model);
- ui.setContextValue(model);
-
fishingOperationMonitor.setBean(model);
}
@@ -80,7 +104,8 @@
return ui.getModel();
}
- public void selectFishingOperation(FishingOperation bean) {
+ public void selectFishingOperation(FishingOperation bean,
+ String fishingOperationText) {
if (fishingOperationMonitor.wasModified()) {
@@ -101,26 +126,16 @@
EditCatchesUIModel model = getModel();
- String fishingoperationText;
-
if (empty) {
bean = new FishingOperation();
model.setFishingOperation(null);
- fishingoperationText = "";
} else {
- Decorator<FishingOperation> decorator =
- getDecorator(FishingOperation.class, null);
-
- fishingoperationText =
- _("tutti.label.traitReminder", decorator.toString(bean));
-
if (log.isInfoEnabled()) {
log.info("Get species batch for fishingOperation: " +
- bean.getId() + " - " + fishingoperationText);
+ bean.getId() + " - " + fishingOperationText);
}
-
model.setFishingOperation(bean);
}
@@ -128,46 +143,27 @@
fishingOperationMonitor.clearModified();
- ui.getFishingOperationReminderLabel().setText(fishingoperationText);
- }
+ ui.getCatchesTabsFishingOperationReminderLabel().setTitle(fishingOperationText);
+ ui.getSpeciesTabFishingOperationReminderLabel().setTitle(fishingOperationText);
+ ui.getBenthosTabFishingOperationReminderLabel().setTitle(fishingOperationText);
+ ui.getPlanktonTabFishingOperationReminderLabel().setTitle(fishingOperationText);
+ ui.getMacroWasteTabFishingOperationReminderLabel().setTitle(fishingOperationText);
+ ui.getAccidentalTabFishingOperationReminderLabel().setTitle(fishingOperationText);
- public void cancel() {
+ ui.getSpeciesTabContent().getHandler().selectFishingOperation(bean
+ );
+ ui.getBenthosTabContent().getHandler().selectFishingOperation(bean
+ );
+ ui.getPlanktonTabContent().getHandler().selectFishingOperation(bean
+ );
+ ui.getMacroWasteTabContent().getHandler().selectFishingOperation(bean
+ );
+ ui.getAccidentalTabContent().getHandler().selectFishingOperation(bean
+ );
- String id = getModel().getId();
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition for fishingOperation: " + id);
- }
- boolean newBean = StringUtils.isBlank(id);
-
- if (newBean) {
-
- // cancel to create a new fishingOperation
- parentUi.getHandler().selectFishingOperation(null);
-
- } else {
-
- // reselect in ui the fishingOperation
- FishingOperation selectedFishingOperation = parentUi.getModel().getSelectedFishingOperation();
- parentUi.getHandler().selectFishingOperation(selectedFishingOperation);
- }
+ ui.getTabPane().repaint();
}
- public void save() {
-
- // get fishingOperation to save
- FishingOperation toSave = getModel().toBean();
-
- if (log.isInfoEnabled()) {
- log.info("Save edition for fishingOperation: " + toSave.getId());
- }
-
- // persist current fishingOperation
- parentUi.getHandler().saveFishingOperation(toSave);
-
- getModel().setModify(false);
- }
-
public void importPupitri() {
//TODO
}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -1,9 +1,33 @@
package fr.ifremer.tutti.ui.swing.content.operation.catches;
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
+import org.nuiton.util.beans.BinderModelBuilder;
/**
* @author tchemit <chemit(a)codelutin.com>
@@ -31,13 +55,34 @@
public static final String PROPERTY_MACRO_WASTE_TOTAL_WEIGHT = "macroWasteTotalWeight";
- protected static Binder<EditCatchesUIModel, FishingOperation> toBeanBinder =
- BinderFactory.newBinder(EditCatchesUIModel.class,
- FishingOperation.class);
+ public static final String PROPERTY_FISHING_OPERATION = "fishingOperation";
- protected static Binder<FishingOperation, EditCatchesUIModel> fromBeanBinder =
- BinderFactory.newBinder(FishingOperation.class, EditCatchesUIModel.class);
+ protected static final Binder<FishingOperation, EditCatchesUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, EditCatchesUIModel.class)
+ .addSimpleProperties(
+ PROPERTY_SPECIES_TOTAL_WEIGHT,
+ PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT,
+ PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT,
+ PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT,
+ PROPERTY_BENTHOS_TOTAL_WEIGHT,
+ PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT,
+ PROPERTY_PLANKTON_TOTAL_WEIGHT,
+ PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT,
+ PROPERTY_MACRO_WASTE_TOTAL_WEIGHT
+ ).toBinder();
+ protected static final Binder<EditCatchesUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(EditCatchesUIModel.class, FishingOperation.class)
+ .addSimpleProperties(
+ PROPERTY_SPECIES_TOTAL_WEIGHT,
+ PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT,
+ PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT,
+ PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT,
+ PROPERTY_BENTHOS_TOTAL_WEIGHT,
+ PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT,
+ PROPERTY_PLANKTON_TOTAL_WEIGHT,
+ PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT,
+ PROPERTY_MACRO_WASTE_TOTAL_WEIGHT
+ ).toBinder();
+
protected Float speciesTotalWeight;
protected Float speciesTotalVracWeight;
@@ -67,7 +112,9 @@
}
public void setFishingOperation(FishingOperation fishingOperation) {
+ Object oldValue = getFishingOperation();
this.fishingOperation = fishingOperation;
+ firePropertyChange(PROPERTY_FISHING_OPERATION, oldValue, fishingOperation);
}
public Float getSpeciesTotalWeight() {
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css 2012-12-20 13:30:24 UTC (rev 94)
@@ -29,14 +29,14 @@
showReset: true;
}
-#totalWeightLabel {
- text: "tutti.label.macroWaste.totalWeight";
- labelFor: {totalWeightField};
+#macroWasteTotalWeightLabel {
+ text: "tutti.label.catches.macroWasteTotalWeight";
+ labelFor: {macroWasteTotalWeightField};
}
-#totalWeightField {
- property: "totalWeight";
- model: {model.getTotalWeight()};
+#macroWasteTotalWeightField {
+ property: "macroWasteTotalWeight";
+ model: {model.getMacroWasteTotalWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx 2012-12-20 13:30:24 UTC (rev 94)
@@ -25,10 +25,9 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<MacroWasteBatchUIModel, MacroWasteBatchUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
-
+ fr.ifremer.tutti.ui.swing.TuttiUI
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
@@ -48,14 +47,13 @@
<script><![CDATA[
-public MacroWasteBatchUI(FishingOperationsUI parentUI) {
+public MacroWasteBatchUI(TuttiUI<?,?> parentUI) {
+ JAXXUtil.initContext(this, parentUI);
MacroWasteBatchUIHandler handler = new MacroWasteBatchUIHandler(parentUI, this);
setContextValue(handler);
handler.beforeInitUI();
}
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
@@ -69,30 +67,25 @@
<BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
+ <field name='macroWasteTotalWeight' component='macroWasteTotalWeightField'/>
</BeanValidator>
<LongTextEditorUI id='longTextEditor'/>
<AttachmentEditorUI id='attachmentEditor'/>
- <JPanel constraints='BorderLayout.NORTH' layout='{new BorderLayout()}'>
- <JLabel id='fishingOperationReminderLabel'
- constraints='BorderLayout.NORTH'/>
- <JSeparator constraints='BorderLayout.CENTER'/>
- <Table id='form' fill='both' constraints='BorderLayout.SOUTH'>
+ <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>
- </Table>
- </JPanel>
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='macroWasteTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='macroWasteTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
<JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
<JXTable id='table'
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -32,7 +32,7 @@
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
@@ -45,7 +45,6 @@
import javax.swing.table.TableColumnModel;
import java.util.List;
-import static org.nuiton.i18n.I18n._;
import static org.nuiton.i18n.I18n.n_;
/**
@@ -65,9 +64,8 @@
*/
private final MacroWasteBatchUI ui;
- public MacroWasteBatchUIHandler(FishingOperationsUI parentUi, MacroWasteBatchUI ui) {
+ public MacroWasteBatchUIHandler(TuttiUI<?, ?> parentUi, MacroWasteBatchUI ui) {
super(parentUi,
- new String[]{MacroWasteBatchUIModel.PROPERTY_TOTAL_WEIGHT},
MacroWasteBatchRowModel.PROPERTY_MACRO_WASTE_CATEGORY,
MacroWasteBatchRowModel.PROPERTY_WEIGHT,
MacroWasteBatchRowModel.PROPERTY_COMMENT);
@@ -262,21 +260,6 @@
table.editingCanceled(null);
}
- if (fishingOperationMonitor.wasModified()) {
-
- // previous fishingOperation was modified, let's save it
- MacroWasteBatchUIModel beanToSave = fishingOperationMonitor.getBean();
-
- FishingOperation fishingOperation = beanToSave.toBean();
-
- if (log.isInfoEnabled()) {
- log.info("FishingOperation " + fishingOperation.getId() +
- " was modified, will save it.");
- }
-
- persistenceService.saveFishingOperation(fishingOperation);
- }
-
// make sure selection is empty (will remove bean from monitor)
table.clearSelection();
@@ -286,24 +269,13 @@
List<MacroWasteBatchRowModel> rows;
- String fishingoperationText;
-
if (empty) {
rows = null;
- bean = new FishingOperation();
- model.setFishingOperation(null);
- fishingoperationText = "";
} else {
- Decorator<FishingOperation> decorator =
- getDecorator(FishingOperation.class, null);
-
- fishingoperationText =
- _("tutti.label.traitReminder", decorator.toString(bean));
-
if (log.isInfoEnabled()) {
log.info("Get species batch for fishingOperation: " +
- bean.getId() + " - " + fishingoperationText);
+ bean.getId());
}
rows = Lists.newArrayList();
@@ -316,15 +288,9 @@
rows.add(entry);
}
}
- model.setFishingOperation(bean);
}
- model.fromBean(bean);
model.setRows(rows);
-
- fishingOperationMonitor.clearModified();
-
- ui.getFishingOperationReminderLabel().setText(fishingoperationText);
}
//------------------------------------------------------------------------//
@@ -338,10 +304,11 @@
log.info("beforeInit: " + ui);
}
- MacroWasteBatchUIModel model = new MacroWasteBatchUIModel();
- ui.setContextValue(model);
+ EditCatchesUIModel catchesUIModel =
+ ui.getContextValue(EditCatchesUIModel.class);
- fishingOperationMonitor.setBean(model);
+ MacroWasteBatchUIModel model = new MacroWasteBatchUIModel(catchesUIModel);
+ ui.setContextValue(model);
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -24,71 +24,27 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderModelBuilder;
+import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class MacroWasteBatchUIModel extends AbstractTuttiTableUIModel<FishingOperation, MacroWasteBatchRowModel, MacroWasteBatchUIModel> {
+public class MacroWasteBatchUIModel extends AbstractTuttiBatchUIModel<MacroWasteBatchRowModel, MacroWasteBatchUIModel> {
private static final long serialVersionUID = 1L;
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- /**
- * Editing fishing operation.
- *
- * @since 0.2
- */
- protected FishingOperation fishingOperation;
-
- /**
- * Total Weight filled in screen.
- *
- * @since 0.2
- */
- protected Float totalWeight;
-
-
- protected static final Binder<FishingOperation, MacroWasteBatchUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, MacroWasteBatchUIModel.class)
- .addProperty(FishingOperation.PROPERTY_MACRO_WASTE_TOTAL_WEIGHT, PROPERTY_TOTAL_WEIGHT)
- .addProperty(FishingOperation.PROPERTY_ID, PROPERTY_ID)
- .toBinder();
-
- protected static final Binder<MacroWasteBatchUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(MacroWasteBatchUIModel.class, FishingOperation.class)
- .addProperty(PROPERTY_TOTAL_WEIGHT, FishingOperation.PROPERTY_MACRO_WASTE_TOTAL_WEIGHT)
- .toBinder();
-
-
- public MacroWasteBatchUIModel() {
- super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ public MacroWasteBatchUIModel(EditCatchesUIModel catchesUIModel) {
+ super(catchesUIModel,
+ EditCatchesUIModel.PROPERTY_MACRO_WASTE_TOTAL_WEIGHT);
}
- public FishingOperation getFishingOperation() {
- return fishingOperation;
+ public Float getMacroWasteTotalWeight() {
+ return catchesUIModel.getMacroWasteTotalWeight();
}
- public void setFishingOperation(FishingOperation fishingOperation) {
- this.fishingOperation = fishingOperation;
+ public void setMacroWasteTotalWeight(Float macroWasteTotalWeight) {
+ catchesUIModel.setMacroWasteTotalWeight(macroWasteTotalWeight);
}
-
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- @Override
- protected FishingOperation newEntity() {
- return fishingOperation;
- }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css 2012-12-20 13:30:24 UTC (rev 94)
@@ -29,26 +29,26 @@
showReset: true;
}
-#totalWeightLabel {
- text: "tutti.label.plankton.totalWeight";
- labelFor: {totalWeightField};
+#planktonTotalWeightLabel {
+ text: "tutti.label.catches.planktonTotalWeight";
+ labelFor: {planktonTotalWeightField};
}
-#totalWeightField {
- property: "totalWeight";
- model: {model.getTotalWeight()};
+#planktonTotalWeightField {
+ property: "planktonTotalWeight";
+ model: {model.getPlanktonTotalWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#sampleTotalWeightLabel {
- text: "tutti.label.plankton.sampleTotalWeight";
- labelFor: {sampleTotalWeightField};
+#planktonSampleTotalWeightLabel {
+ text: "tutti.label.catches.planktonSampleTotalWeight";
+ labelFor: {planktonSampleTotalWeightField};
}
-#sampleTotalWeightField {
- property: "sampleTotalWeight";
- model: {model.getSampleTotalWeight()};
+#planktonSampleTotalWeightField {
+ property: "planktonSampleTotalWeight";
+ model: {model.getPlanktonSampleTotalWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx 2012-12-20 13:30:24 UTC (rev 94)
@@ -25,10 +25,8 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<PlanktonBatchUIModel, PlanktonBatchUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
-
+ fr.ifremer.tutti.ui.swing.TuttiUI
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
@@ -48,14 +46,13 @@
<script><![CDATA[
-public PlanktonBatchUI(FishingOperationsUI parentUI) {
+public PlanktonBatchUI(TuttiUI<?,?> parentUI) {
+ JAXXUtil.initContext(this, parentUI);
PlanktonBatchUIHandler handler = new PlanktonBatchUIHandler(parentUI, this);
setContextValue(handler);
handler.beforeInitUI();
}
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
@@ -69,41 +66,38 @@
<BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ <field name='planktonTotalWeight' component='planktonTotalWeightField'/>
+ <field name='planktonSampleTotalWeight'
+ component='planktonSampleTotalWeightField'/>
</BeanValidator>
<LongTextEditorUI id='longTextEditor'/>
<AttachmentEditorUI id='attachmentEditor'/>
- <JPanel constraints='BorderLayout.NORTH' layout='{new BorderLayout()}'>
- <JLabel id='fishingOperationReminderLabel'
- constraints='BorderLayout.NORTH'/>
- <JSeparator constraints='BorderLayout.CENTER'/>
- <Table id='form' fill='both' constraints='BorderLayout.SOUTH'>
+ <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 -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='planktonTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='planktonTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </JPanel>
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='planktonSampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='planktonSampleTotalWeightField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
<JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
<JXTable id='table'
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -33,7 +33,7 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
@@ -46,7 +46,6 @@
import javax.swing.table.TableColumnModel;
import java.util.List;
-import static org.nuiton.i18n.I18n._;
import static org.nuiton.i18n.I18n.n_;
/**
@@ -56,7 +55,8 @@
public class PlanktonBatchUIHandler extends AbstractTuttiBatchTableUIHandler<PlanktonBatchRowModel, PlanktonBatchUIModel> {
/** Logger. */
- private static final Log log = LogFactory.getLog(PlanktonBatchUIHandler.class);
+ private static final Log log =
+ LogFactory.getLog(PlanktonBatchUIHandler.class);
/**
* UI.
@@ -65,9 +65,8 @@
*/
private final PlanktonBatchUI ui;
- public PlanktonBatchUIHandler(FishingOperationsUI parentUi, PlanktonBatchUI ui) {
- super(parentUi, new String[]{PlanktonBatchUIModel.PROPERTY_TOTAL_WEIGHT,
- PlanktonBatchUIModel.PROPERTY_SAMPLE_TOTAL_WEIGHT},
+ public PlanktonBatchUIHandler(TuttiUI<?, ?> parentUi, PlanktonBatchUI ui) {
+ super(parentUi,
PlanktonBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
PlanktonBatchRowModel.PROPERTY_SPECIES,
PlanktonBatchRowModel.PROPERTY_WEIGHT,
@@ -304,21 +303,6 @@
table.editingCanceled(null);
}
- if (fishingOperationMonitor.wasModified()) {
-
- // previous fishingOperation was modified, let's save it
- PlanktonBatchUIModel beanToSave = fishingOperationMonitor.getBean();
-
- FishingOperation fishingOperation = beanToSave.toBean();
-
- if (log.isInfoEnabled()) {
- log.info("FishingOperation " + fishingOperation.getId() +
- " was modified, will save it.");
- }
-
- persistenceService.saveFishingOperation(fishingOperation);
- }
-
// make sure selection is empty (will remove bean from monitor)
table.clearSelection();
@@ -328,24 +312,14 @@
List<PlanktonBatchRowModel> rows;
- String fishingoperationText;
-
if (empty) {
rows = null;
- bean = new FishingOperation();
- model.setFishingOperation(null);
- fishingoperationText = "";
} else {
- Decorator<FishingOperation> decorator =
- getDecorator(FishingOperation.class, null);
- fishingoperationText =
- _("tutti.label.traitReminder", decorator.toString(bean));
-
if (log.isInfoEnabled()) {
log.info("Get species batch for fishingOperation: " +
- bean.getId() + " - " + fishingoperationText);
+ bean.getId());
}
rows = Lists.newArrayList();
@@ -358,15 +332,9 @@
rows.add(entry);
}
}
- model.setFishingOperation(bean);
}
- model.fromBean(bean);
model.setRows(rows);
-
- fishingOperationMonitor.clearModified();
-
- ui.getFishingOperationReminderLabel().setText(fishingoperationText);
}
//------------------------------------------------------------------------//
@@ -380,10 +348,11 @@
log.info("beforeInit: " + ui);
}
- PlanktonBatchUIModel model = new PlanktonBatchUIModel();
- ui.setContextValue(model);
+ EditCatchesUIModel catchesUIModel =
+ ui.getContextValue(EditCatchesUIModel.class);
- fishingOperationMonitor.setBean(model);
+ PlanktonBatchUIModel model = new PlanktonBatchUIModel(catchesUIModel);
+ ui.setContextValue(model);
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -24,90 +24,36 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderModelBuilder;
+import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class PlanktonBatchUIModel extends AbstractTuttiTableUIModel<FishingOperation, PlanktonBatchRowModel, PlanktonBatchUIModel> {
+public class PlanktonBatchUIModel extends AbstractTuttiBatchUIModel<PlanktonBatchRowModel, PlanktonBatchUIModel> {
private static final long serialVersionUID = 1L;
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- /**
- * Editing fishing operation.
- *
- * @since 0.2
- */
- protected FishingOperation fishingOperation;
-
- /**
- * Total Weight filled in screen.
- *
- * @since 0.2
- */
- protected Float totalWeight;
-
- /**
- * Total Sample Weight filled in screen.
- *
- * @since 0.2
- */
- protected Float sampleTotalWeight;
-
- protected static final Binder<FishingOperation, PlanktonBatchUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, PlanktonBatchUIModel.class)
- .addProperty(FishingOperation.PROPERTY_PLANKTON_TOTAL_WEIGHT, PROPERTY_TOTAL_WEIGHT)
- .addProperty(FishingOperation.PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT, PROPERTY_SAMPLE_TOTAL_WEIGHT)
- .addProperty(FishingOperation.PROPERTY_ID, PROPERTY_ID)
- .toBinder();
-
- protected static final Binder<PlanktonBatchUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(PlanktonBatchUIModel.class, FishingOperation.class)
- .addProperty(PROPERTY_TOTAL_WEIGHT, FishingOperation.PROPERTY_PLANKTON_TOTAL_WEIGHT)
- .addProperty(PROPERTY_SAMPLE_TOTAL_WEIGHT, FishingOperation.PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT)
- .toBinder();
-
-
- public PlanktonBatchUIModel() {
- super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ public PlanktonBatchUIModel(EditCatchesUIModel catchesUIModel) {
+ super(catchesUIModel,
+ EditCatchesUIModel.PROPERTY_PLANKTON_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT);
}
- public FishingOperation getFishingOperation() {
- return fishingOperation;
+ public Float getPlanktonTotalWeight() {
+ return catchesUIModel.getPlanktonTotalWeight();
}
- public void setFishingOperation(FishingOperation fishingOperation) {
- this.fishingOperation = fishingOperation;
+ public void setPlanktonTotalWeight(Float planktonTotalWeight) {
+ catchesUIModel.setPlanktonTotalWeight(planktonTotalWeight);
}
- public Float getTotalWeight() {
- return totalWeight;
+ public Float getPlanktonSampleTotalWeight() {
+ return catchesUIModel.getPlanktonSampleTotalWeight();
}
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ public void setPlanktonSampleTotalWeight(Float planktonSampleTotalWeight) {
+ catchesUIModel.setPlanktonSampleTotalWeight(planktonSampleTotalWeight);
}
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- @Override
- protected FishingOperation newEntity() {
- return fishingOperation;
- }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css 2012-12-20 13:30:24 UTC (rev 94)
@@ -29,49 +29,49 @@
showReset: true;
}
-#totalWeightLabel {
- text: "tutti.label.species.totalWeight";
- labelFor: {totalWeightField};
+#speciesTotalWeightLabel {
+ text: "tutti.label.catches.speciesTotalWeight";
+ labelFor: {speciesTotalWeightField};
}
-#totalWeightField {
- property: "totalWeight";
- model: {model.getTotalWeight()};
+#speciesTotalWeightField {
+ property: "speciesTotalWeight";
+ model: {model.getSpeciesTotalWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#totalVracWeightLabel {
- text: "tutti.label.species.totalVracWeight";
- labelFor: {totalVracWeightField};
+#speciesTotalVracWeightLabel {
+ text: "tutti.label.catches.speciesTotalVracWeight";
+ labelFor: {speciesTotalVracWeightField};
}
-#totalVracWeightField {
- property: "totalVracWeight";
- model: {model.getTotalVracWeight()};
+#speciesTotalVracWeightField {
+ property: "speciesTotalVracWeight";
+ model: {model.getSpeciesTotalVracWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#sampleVracWeightLabel {
- text: "tutti.label.species.sampleVracWeight";
- labelFor: {sampleVracWeightField};
+#speciesSampleVracWeightLabel {
+ text: "tutti.label.catches.speciesSampleVracWeight";
+ labelFor: {speciesSampleVracWeightField};
}
-#sampleVracWeightField {
- property: "sampleVracWeight";
- model: {model.getSampleVracWeight()};
+#speciesSampleVracWeightField {
+ property: "speciesSampleVracWeight";
+ model: {model.getSpeciesSampleVracWeight()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#totalHorsVracWeightLabel {
- text: "tutti.label.species.totalHorsVracWeight";
- labelFor: {totalHorsVracWeightField};
+#speciesTotalHorsVracWeightLabel {
+ text: "tutti.label.catches.speciesTotalHorsVracWeight";
+ labelFor: {speciesTotalHorsVracWeightField};
}
-#totalHorsVracWeightField {
- text: {getStringValue(model.getTotalHorsVracWeight())};
+#speciesTotalHorsVracWeightField {
+ text: {getStringValue(model.getSpeciesTotalHorsVracWeight())};
editable: false;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx 2012-12-20 13:30:24 UTC (rev 94)
@@ -25,11 +25,9 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesBatchUIModel, SpeciesBatchUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
-
+ fr.ifremer.tutti.ui.swing.TuttiUI
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
- fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesFrequencyUI
+
fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
@@ -50,14 +48,13 @@
<script><![CDATA[
-public SpeciesBatchUI(FishingOperationsUI parentUI) {
+public SpeciesBatchUI(TuttiUI<?,?> parentUI) {
+ JAXXUtil.initContext(this, parentUI);
SpeciesBatchUIHandler handler = new SpeciesBatchUIHandler(parentUI, this);
setContextValue(handler);
handler.beforeInitUI();
}
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
@@ -71,10 +68,13 @@
<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'/>
+ <field name='speciesTotalWeight' component='speciesTotalWeightField'/>
+ <field name='speciesTotalVracWeight'
+ component='speciesTotalVracWeightField'/>
+ <field name='speciesSampleVracWeight'
+ component='speciesSampleVracWeightField'/>
+ <field name='speciesTotalHorsVracWeight'
+ component='speciesTotalHorsVracWeightField'/>
</BeanValidator>
<SpeciesFrequencyUI id='frequencyEditor'
@@ -83,47 +83,43 @@
<LongTextEditorUI id='longTextEditor'/>
<AttachmentEditorUI id='attachmentEditor'/>
- <JPanel constraints='BorderLayout.NORTH' layout='{new BorderLayout()}'>
- <JLabel id='fishingOperationReminderLabel'
- constraints='BorderLayout.NORTH'/>
- <JSeparator constraints='BorderLayout.CENTER'/>
- <Table id='form' fill='both' constraints='BorderLayout.SOUTH'>
+ <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 total / Poids total vrac -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='speciesTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='speciesTotalWeightField' constructorParams='this'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='speciesTotalVracWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='speciesTotalVracWeightField'
+ 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>
- <JTextField id='totalHorsVracWeightField'/>
- </cell>
- </row>
- </Table>
- </JPanel>
+ <!-- Poids échantillonné vrac / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='speciesSampleVracWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='speciesSampleVracWeightField'
+ constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='speciesTotalHorsVracWeightLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='speciesTotalHorsVracWeightField'/>
+ </cell>
+ </row>
+ </Table>
-
<JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
<JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event)'/>
</JScrollPane>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -38,7 +38,7 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
@@ -52,7 +52,6 @@
import java.util.List;
import java.util.Set;
-import static org.nuiton.i18n.I18n._;
import static org.nuiton.i18n.I18n.n_;
/**
@@ -84,15 +83,9 @@
*/
private final SpeciesBatchUI ui;
- public SpeciesBatchUIHandler(FishingOperationsUI parentUi,
+ public SpeciesBatchUIHandler(TuttiUI<?, ?> parentUi,
SpeciesBatchUI ui) {
super(parentUi,
- new String[]{
- SpeciesBatchUIModel.PROPERTY_SAMPLE_VRAC_WEIGHT,
- SpeciesBatchUIModel.PROPERTY_TOTAL_HORS_VRAC_WEIGHT,
- SpeciesBatchUIModel.PROPERTY_TOTAL_VRAC_WEIGHT,
- SpeciesBatchUIModel.PROPERTY_TOTAL_WEIGHT
- },
SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
SpeciesBatchRowModel.PROPERTY_SPECIES,
SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
@@ -504,21 +497,6 @@
table.editingCanceled(null);
}
- if (fishingOperationMonitor.wasModified()) {
-
- // previous fishingOperation was modified, let's save it
- SpeciesBatchUIModel beanToSave = fishingOperationMonitor.getBean();
-
- FishingOperation fishingOperation = beanToSave.toBean();
-
- if (log.isInfoEnabled()) {
- log.info("FishingOperation " + fishingOperation.getId() +
- " was modified, will save it.");
- }
-
- persistenceService.saveFishingOperation(fishingOperation);
- }
-
// make sure selection is empty (will remove bean from monitor)
table.clearSelection();
@@ -528,24 +506,13 @@
List<SpeciesBatchRowModel> rows;
- String fishingoperationText;
-
if (empty) {
rows = null;
- bean = new FishingOperation();
- model.setFishingOperation(null);
- fishingoperationText = "";
} else {
- Decorator<FishingOperation> decorator =
- getDecorator(FishingOperation.class, null);
-
- fishingoperationText =
- _("tutti.label.traitReminder", decorator.toString(bean));
-
if (log.isInfoEnabled()) {
log.info("Get species batch for fishingOperation: " +
- bean.getId() + " - " + fishingoperationText);
+ bean.getId());
}
rows = Lists.newArrayList();
@@ -560,15 +527,9 @@
rows.add(entry);
}
}
- model.setFishingOperation(bean);
}
- model.fromBean(bean);
model.setRows(rows);
-
- fishingOperationMonitor.clearModified();
-
- ui.getFishingOperationReminderLabel().setText(fishingoperationText);
}
//------------------------------------------------------------------------//
@@ -582,10 +543,11 @@
log.info("beforeInit: " + ui);
}
- SpeciesBatchUIModel model = new SpeciesBatchUIModel();
- ui.setContextValue(model);
+ EditCatchesUIModel catchesUIModel =
+ ui.getContextValue(EditCatchesUIModel.class);
- fishingOperationMonitor.setBean(model);
+ SpeciesBatchUIModel model = new SpeciesBatchUIModel(catchesUIModel);
+ ui.setContextValue(model);
}
@Override
@@ -658,7 +620,7 @@
// Use directly the batch total weight (means no super-sampling)
- superSamplingTotalWeight = getModel().getTotalWeight();
+ superSamplingTotalWeight = getModel().getSpeciesTotalWeight();
} else {
superSamplingTotalWeight = superSamplingRow.getWeight();
}
@@ -714,7 +676,7 @@
log.info("New total vrac / hors vrac: " +
totalVrac + " / " + totalHorsVrac);
}
- getModel().setTotalHorsVracWeight(totalHorsVrac);
+ getModel().setSpeciesTotalHorsVracWeight(totalHorsVrac);
//TODO Should we also set the total vrac weight ?
// getModel().setTotalVracWeight(totalVrac);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java 2012-12-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java 2012-12-20 13:30:24 UTC (rev 94)
@@ -25,9 +25,8 @@
*/
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderModelBuilder;
+import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import java.util.List;
@@ -35,54 +34,11 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class SpeciesBatchUIModel extends AbstractTuttiTableUIModel<FishingOperation, SpeciesBatchRowModel, SpeciesBatchUIModel> {
+public class SpeciesBatchUIModel extends AbstractTuttiBatchUIModel<SpeciesBatchRowModel, SpeciesBatchUIModel> {
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";
-
/**
- * Editing fishing operation.
- *
- * @since 0.2
- */
- protected FishingOperation fishingOperation;
-
- /**
- * Total Weight filled in screen.
- *
- * @since 0.2
- */
- protected Float totalWeight;
-
- /**
- * Total vrac Weight filled in screen.
- *
- * @since 0.2
- */
- protected Float totalVracWeight;
-
- /**
- * Total sample vrac Weight filled in screen.
- *
- * @since 0.2
- */
- protected Float sampleVracWeight;
-
- /**
- * Total hors vrac Weight computed by hros vrac rows.
- *
- * @since 0.2
- */
- protected Float totalHorsVracWeight;
-
- /**
* Sampling order (sets by protocol).
*
* @since 0.2
@@ -96,78 +52,51 @@
*/
protected final SpeciesBatchTreeModel samplingTreeModel;
- protected static final Binder<FishingOperation, SpeciesBatchUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, SpeciesBatchUIModel.class)
- .addProperty(FishingOperation.PROPERTY_SPECIES_TOTAL_WEIGHT, PROPERTY_TOTAL_WEIGHT)
- .addProperty(FishingOperation.PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT, PROPERTY_TOTAL_HORS_VRAC_WEIGHT)
- .addProperty(FishingOperation.PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT, PROPERTY_TOTAL_VRAC_WEIGHT)
- .addProperty(FishingOperation.PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT, PROPERTY_SAMPLE_VRAC_WEIGHT)
- .addProperty(FishingOperation.PROPERTY_ID, PROPERTY_ID)
- .toBinder();
-
- protected static final Binder<SpeciesBatchUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesBatchUIModel.class, FishingOperation.class)
- .addProperty(PROPERTY_TOTAL_WEIGHT, FishingOperation.PROPERTY_SPECIES_TOTAL_WEIGHT)
- .addProperty(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, FishingOperation.PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT)
- .addProperty(PROPERTY_TOTAL_VRAC_WEIGHT, FishingOperation.PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT)
- .addProperty(PROPERTY_SAMPLE_VRAC_WEIGHT, FishingOperation.PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT)
- .toBinder();
-
- public SpeciesBatchUIModel() {
- super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ public SpeciesBatchUIModel(EditCatchesUIModel catchesUIModel) {
+ super(catchesUIModel,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT);
this.samplingTreeModel = new SpeciesBatchTreeModel();
}
- public FishingOperation getFishingOperation() {
- return fishingOperation;
+ public Float getSpeciesTotalWeight() {
+ return catchesUIModel.getSpeciesTotalWeight();
}
- public void setFishingOperation(FishingOperation fishingOperation) {
- this.fishingOperation = fishingOperation;
+ public void setSpeciesTotalWeight(Float speciesTotalWeight) {
+ catchesUIModel.setSpeciesTotalWeight(speciesTotalWeight);
}
- public SpeciesBatchTreeModel getSamplingTreeModel() {
- return samplingTreeModel;
+ public Float getSpeciesTotalVracWeight() {
+ return catchesUIModel.getSpeciesTotalVracWeight();
}
- public Float getTotalWeight() {
- return totalWeight;
+ public void setSpeciesTotalVracWeight(Float speciesTotalVracWeight) {
+ catchesUIModel.setSpeciesTotalVracWeight(speciesTotalVracWeight);
}
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ public Float getSpeciesSampleVracWeight() {
+ return catchesUIModel.getSpeciesSampleVracWeight();
}
- public Float getTotalVracWeight() {
- return totalVracWeight;
+ public void setSpeciesSampleVracWeight(Float speciesSampleVracWeight) {
+ catchesUIModel.setSpeciesSampleVracWeight(speciesSampleVracWeight);
}
- public void setTotalVracWeight(Float totalVracWeight) {
- Object oldValue = getTotalVracWeight();
- this.totalVracWeight = totalVracWeight;
- firePropertyChange(PROPERTY_TOTAL_VRAC_WEIGHT, oldValue, totalVracWeight);
+ public Float getSpeciesTotalHorsVracWeight() {
+ return catchesUIModel.getSpeciesTotalHorsVracWeight();
}
- public Float getSampleVracWeight() {
- return sampleVracWeight;
+ public void setSpeciesTotalHorsVracWeight(Float speciesTotalHorsVracWeight) {
+ catchesUIModel.setSpeciesTotalHorsVracWeight(speciesTotalHorsVracWeight);
}
- public void setSampleVracWeight(Float sampleVracWeight) {
- Object oldValue = getSampleVracWeight();
- this.sampleVracWeight = sampleVracWeight;
- firePropertyChange(PROPERTY_SAMPLE_VRAC_WEIGHT, oldValue, sampleVracWeight);
+ public SpeciesBatchTreeModel getSamplingTreeModel() {
+ return samplingTreeModel;
}
- 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<String> getSamplingOrder() {
return samplingOrder;
}
@@ -177,8 +106,4 @@
samplingTreeModel.setSamplingOrder(samplingOrder.toArray(new String[samplingOrder.size()]));
}
- @Override
- protected FishingOperation newEntity() {
- return fishingOperation;
- }
}
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-20 11:29:15 UTC (rev 93)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-20 13:30:24 UTC (rev 94)
@@ -45,8 +45,15 @@
tutti.label.attachmentEditor.file=Fichier
tutti.label.attachmentEditor.fileComment=Commentaire
tutti.label.attachmentEditor.fileName=Nom
-tutti.label.benthos.sampleTotalWeight=Poids total échantillonné
-tutti.label.benthos.totalWeight=Poids total
+tutti.label.catches.benthosSampleTotalWeight=Poids total échantillonné
+tutti.label.catches.benthosTotalWeight=Poids total
+tutti.label.catches.macroWasteTotalWeight=Poids total
+tutti.label.catches.planktonSampleTotalWeight=Poids total échantillonné
+tutti.label.catches.planktonTotalWeight=Poids total
+tutti.label.catches.speciesSampleVracWeight=Poids total vrac échantillon
+tutti.label.catches.speciesTotalHorsVracWeight=Poids total hors vrac
+tutti.label.catches.speciesTotalVracWeight=Poids total vrac
+tutti.label.catches.speciesTotalWeight=Poids total
tutti.label.comment=Commentaire
tutti.label.cruise=Campagne
tutti.label.cruise.beginDate=Date de début
@@ -111,25 +118,16 @@
tutti.label.list.headOfSortRoom=Reponsable(s) de salle de tri
tutti.label.list.saisisseur=Saisisseur(s)
tutti.label.list.vessel=Navire(s)
-tutti.label.macroWaste.totalWeight=Poids total
tutti.label.no.fishingOperation.selected=< Aucun trait sélectionné >
-tutti.label.plankton.sampleTotalWeight=Poids total échantillonné
-tutti.label.plankton.totalWeight=Poids total
tutti.label.program=Série de campagne
tutti.label.program.name=Nom
tutti.label.program.zone=Zone
tutti.label.protocol=Protocol de saisie
-tutti.label.species.sampleVracWeight=Poids total vrac échant.
-tutti.label.species.speciesSampleVracWeight=Poids total vrac échantillon
-tutti.label.species.speciesTotalHorsVracWeight=Poids total hors vrac
-tutti.label.species.speciesTotalVracWeight=Poids total vrac
-tutti.label.species.speciesTotalWeight=Poids total
-tutti.label.species.totalHorsVracWeight=Poids total hors vrac
-tutti.label.species.totalVracWeight=Poids total vrac
-tutti.label.species.totalWeight=Poids total
+tutti.label.species.speciesTotalHorsVracWeight=
tutti.label.tab.accidentel=Captures accidentelles
tutti.label.tab.benthos=Benthos
tutti.label.tab.catches=Captures
+tutti.label.tab.catchesCaracteristics=Caractéristiques générales
tutti.label.tab.fishingOperation=Trait
tutti.label.tab.fishingOperation.environment=Environnement
tutti.label.tab.fishingOperation.gearShooting=Mise en oeuvre de l'engin
@@ -140,7 +138,12 @@
tutti.label.tab.plancton=Plancton
tutti.label.tab.species=Espèces
tutti.label.traitReminder=Trait \: %s
+tutti.legend.accidentalCatches=Captures accidentelles
+tutti.legend.benthosCatches=Captures benthos
tutti.legend.frequencyConfiguration=Configuration
+tutti.legend.macroWasteCatches=Captures macro déchets
+tutti.legend.planktonCatches=Captures plancton
+tutti.legend.speciesCatches=Captures espèces
tutti.menu.actions=Actions
tutti.menu.actions.tip=Actions
tutti.menu.file=Fichier
1
0
r93 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing/content/operation java/fr/ifremer/tutti/ui/swing/content/operation/fishing java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology java/fr/ifremer/tutti/ui/swing/util/table resources/i18n
by kmorin@users.forge.codelutin.com Dec. 20, 2012
by kmorin@users.forge.codelutin.com Dec. 20, 2012
Dec. 20, 2012
Author: kmorin
Date: 2012-12-20 12:29:15 +0100 (Thu, 20 Dec 2012)
New Revision: 93
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/93
Log:
refs #1812
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTableModel.java
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2012-12-19 23:24:11 UTC (rev 92)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2012-12-20 11:29:15 UTC (rev 93)
@@ -31,6 +31,8 @@
fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor
fr.ifremer.tutti.ui.swing.content.operation.fishing.environment.EnvironmentTabUI
+ fr.ifremer.tutti.ui.swing.content.operation.fishing.gearshooting.GearShootingTabUI
+ fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology.HydrologyTabUI
jaxx.runtime.swing.editor.bean.BeanComboBox
jaxx.runtime.swing.editor.bean.BeanListHeader
@@ -304,225 +306,22 @@
<tab id='traitGearShootingTab'
title='tutti.label.tab.fishingOperation.gearShooting'>
- <Table fill='both' id='gearShootingForm'>
-
- <!--row>
- <cell>
- <JLabel id='gearShootingStartDepthLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartDepthField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel id='gearShootingEndDepthLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndDepthField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell anchor='west'>
- <JLabel id='ouvertureHorizontaleLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='ouvertureHorizontaleField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell anchor='west'>
- <JLabel id='ouvertureVerticaleLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='ouvertureVerticaleField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell anchor='west'>
- <JLabel id='longueurFunesLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='longueurFunesField' constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell anchor='west'>
- <JLabel id='longueurBrasLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='longueurBrasField' constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JCheckBox id='systemeFermetureCulCheckBox'
- onItemStateChanged='handler.setBoolean(event, "systemeFermetureCul")'/>
- <JCheckBox id='geometrieMesureeCheckBox'
- onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
- </JPanel>
- </cell>
- </row-->
- </Table>
+ <GearShootingTabUI id='gearShootingTabContent' constructorParams='this'/>
+
</tab>
<tab id='environmentTab'
title='tutti.label.tab.fishingOperation.environment'>
<EnvironmentTabUI id='environmentTabContent' constructorParams='this'/>
- <!-- <Table fill='both' id='environmentForm'>
-
- Beaufort scale
- <row>
- <cell anchor='west'>
- <JLabel id='beaufortScaleLabel'/>
- </cell>
- <cell weightx='1.0'>
- <BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
- genericType='BeaufortScale'/>
- </cell>
- </row>
-
- Wind direction
- <row>
- <cell anchor='west'>
- <JLabel id='windDirectionLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='windDirectionField' constructorParams='this'/>
- </cell>
- </row>
-
- Sea state
- <row>
- <cell anchor='west'>
- <JLabel id='seaStateLabel'/>
- </cell>
- <cell fill='horizontal'>
- <BeanComboBox id='seaStateComboBox' constructorParams='this'
- genericType='SeaState'/>
- </cell>
- </row>
- </Table>-->
+
</tab>
<tab id='traitHydrologyTabContent'
title='tutti.label.tab.fishingOperation.hydrology'>
- <Table fill='both' id='hydrologyForm'>
+ <HydrologyTabUI id='hydrologyTabContent' constructorParams='this'/>
- <!--row>
- <cell>
- <JLabel id='gearShootingStartSurfaceTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartSurfaceTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel id='gearShootingEndSurfaceTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndSurfaceTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel id='gearShootingStartBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel id='gearShootingEndBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel id='averageBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='averageBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel id='gearShootingStartSurfaceSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartSurfaceSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel id='gearShootingEndSurfaceSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndSurfaceSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel id='gearShootingStartBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel id='gearShootingEndBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel id='averageBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='averageBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row-->
-
- </Table>
</tab>
</JTabbedPane>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-19 23:24:11 UTC (rev 92)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.ui.swing.content.operation.fishing.gearshooting.GearShootingTabUI;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
@@ -33,7 +34,11 @@
import fr.ifremer.tutti.persistence.entities.referential.Zone;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.fishing.environment.EnvironmentTabUI;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.environment.EnvironmentTabUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.fishing.gearshooting.GearShootingTabUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology.HydrologyTabUI;
+import fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology.HydrologyTabUIModel;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -179,8 +184,26 @@
model.setEmpty(true);
listenValidatorValid(ui.getValidator(), getModel());
+
+ //init gear shooting
+ GearShootingTabUIModel gearShootingModel =
+ ui.getGearShootingTabContent().getModel();
+ gearShootingModel.addPropertyChangeListener(
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_PARAMETERS,
+ new PropertyChangeListener() {
- EnvironmentTabUIModel environmentModel =
+ public void propertyChange(PropertyChangeEvent evt) {
+ model.setModify(true);
+ model.setGearShootingParameters((Map<Object, Object>)evt.getNewValue());
+ }
+ }
+ );
+ Map<Object, Object> gearShootingParams = getDefaultGearShootingParams();
+ ui.getModel().setGearShootingParameters(gearShootingParams);
+ gearShootingModel.setGearShootingParameters(gearShootingParams);
+
+ //init environment
+ EnvironmentTabUIModel environmentModel =
ui.getEnvironmentTabContent().getModel();
environmentModel.addPropertyChangeListener(
EditFishingOperationUIModel.PROPERTY_ENVIRONMENT_PARAMETERS,
@@ -188,14 +211,71 @@
public void propertyChange(PropertyChangeEvent evt) {
model.setModify(true);
+ model.setEnvironmentParameters((Map<Object, Object>)evt.getNewValue());
}
}
+ );
+ Map<Object, Object> environmentParams = getDefaultEnvironmentParams();
+ ui.getModel().setEnvironmentParameters(environmentParams);
+ environmentModel.setEnvironmentParameters(environmentParams);
+
+ //init hydrology
+ HydrologyTabUIModel hydrologyModel =
+ ui.getHydrologyTabContent().getModel();
+ hydrologyModel.addPropertyChangeListener(
+ EditFishingOperationUIModel.PROPERTY_HYDROLOGY_PARAMETERS,
+ new PropertyChangeListener() {
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ model.setModify(true);
+ }
+ }
);
- environmentModel.setEnvironmentParameters(getDefaultEnvironmentParams());
+ Map<Object, Object> hydrologyParams = getDefaultHydrologyParams();
+ ui.getModel().setHydrologyParameters(hydrologyParams);
+ hydrologyModel.setHydrologyParameters(getDefaultHydrologyParams());
}
+ protected Map<Object, Object> getDefaultGearShootingParams() {
+ Map<Object, Object> gearShootingParams = Maps.newLinkedHashMap();
+ gearShootingParams.put(
+ _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_START_DEPTH)),
+ null
+ );
+ gearShootingParams.put(
+ _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_END_DEPTH)),
+ null
+ );
+ gearShootingParams.put(
+ _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_HORIZONTAL_APERTURE)),
+ null
+ );
+ gearShootingParams.put(
+ _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_VERTICAL_APERTURE)),
+ null
+ );
+ gearShootingParams.put(
+ _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_WARP_LENGTH)),
+ null
+ );
+ gearShootingParams.put(
+ _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_ARM_LENGTH)),
+ null
+ );
+ gearShootingParams.put(
+ _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_SYSTEME_FERMETURE_CUL)),
+ null
+ );
+ gearShootingParams.put(
+ _(new String("tutti.table.fishing.gearShooting.keys." + GearShootingTabUIModel.KEY_MEASURED_GEOMETRY)),
+ null
+ );
+
+ return gearShootingParams;
+ }
+
protected Map<Object, Object> getDefaultEnvironmentParams() {
- Map<Object, Object> environmentParams = Maps.newHashMap();
+ Map<Object, Object> environmentParams = Maps.newLinkedHashMap();
environmentParams.put(
_(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_BEAUFORT_SCALE)),
null
@@ -211,6 +291,27 @@
return environmentParams;
}
+ protected Map<Object, Object> getDefaultHydrologyParams() {
+ Map<Object, Object> hydrologyParams = Maps.newLinkedHashMap();
+ hydrologyParams.put(
+ _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.TEMPERATURE + "." + HydrologyTabUIModel.SURFACE)),
+ null
+ );
+ hydrologyParams.put(
+ _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.TEMPERATURE + "." + HydrologyTabUIModel.BOTTOM)),
+ null
+ );
+ hydrologyParams.put(
+ _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.SALINITY + "." + HydrologyTabUIModel.SURFACE)),
+ null
+ );
+ hydrologyParams.put(
+ _(new String("tutti.table.fishing.hydrology.keys." + HydrologyTabUIModel.SALINITY + "." + HydrologyTabUIModel.BOTTOM)),
+ null
+ );
+ return hydrologyParams;
+ }
+
@Override
public void onCloseUI() {
}
@@ -244,8 +345,20 @@
// if new fishingOperation can already cancel his creation
model.setModify(!empty && model.isCreate());
- ui.getEnvironmentTabContent().getModel().setEnvironmentParameters(getDefaultEnvironmentParams());
- ui.getEnvironmentTabContent().getHandler().reset();
+ //reset gear shooting
+ GearShootingTabUI gearShootingTab = ui.getGearShootingTabContent();
+ gearShootingTab.getModel().setGearShootingParameters(getDefaultGearShootingParams());
+ gearShootingTab.getHandler().reset();
+
+ //reset environment
+ EnvironmentTabUI environmentTab = ui.getEnvironmentTabContent();
+ environmentTab.getModel().setEnvironmentParameters(getDefaultEnvironmentParams());
+ environmentTab.getHandler().reset();
+
+ //reset hydrology
+ HydrologyTabUI hydrologyTab = ui.getHydrologyTabContent();
+ hydrologyTab.getModel().setHydrologyParameters(getDefaultHydrologyParams());
+ hydrologyTab.getHandler().reset();
}
public void cancel() {
@@ -289,6 +402,14 @@
ui.getFishingOperationTabPane().setSelectedIndex(selectedIndex);
getModel().setModify(false);
+
+ for (Object key : ui.getModel().getEnvironmentParameters().keySet()) {
+ log.info(key + " : " + ui.getModel().getEnvironmentParameters().get(key));
+ }
+
+ for (Object key : ui.getModel().getHydrologyParameters().keySet()) {
+ log.info(key + " : " + ui.getModel().getHydrologyParameters().get(key));
+ }
}
public void importPupitri() {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-19 23:24:11 UTC (rev 92)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -71,8 +71,6 @@
public static final String PROPERTY_GEAR_SHOOTING_END_DATE = "gearShootingEndDate";
- public static final String PROPERTY_ENVIRONMENT_PARAMETERS = "environmentParameters";
-
public static final String PROPERTY_FISHING_OPERATION_RECTILIGNE = "fishingOperationRectiligne";
public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee";
@@ -87,6 +85,12 @@
public static final String PROPERTY_SAISISSEUR = "saisisseur";
+ public static final String PROPERTY_GEAR_SHOOTING_PARAMETERS = "gearShootingParameters";
+
+ public static final String PROPERTY_ENVIRONMENT_PARAMETERS = "environmentParameters";
+
+ public static final String PROPERTY_HYDROLOGY_PARAMETERS = "hydrologyParameters";
+
protected boolean empty;
protected Cruise cruise;
@@ -127,8 +131,6 @@
protected Integer gearShootingEndTime;
- protected Map<Object, Object> environmentParameters;
-
protected boolean fishingOperationRectiligne;
protected Float distanceChalutee;
@@ -142,7 +144,13 @@
protected String comment;
protected List<Person> saisisseur;
+
+ protected Map<Object, Object> gearShootingParameters;
+
+ protected Map<Object, Object> environmentParameters;
+ protected Map<Object, Object> hydrologyParameters;
+
protected static Binder<EditFishingOperationUIModel, FishingOperation> toBeanBinder =
BinderFactory.newBinder(EditFishingOperationUIModel.class,
FishingOperation.class);
@@ -282,16 +290,6 @@
firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, gearShootingEndDate);
}
- public Map<Object, Object> getEnvironmentParameters() {
- return environmentParameters;
- }
-
- public void setEnvironmentParameters(Map<Object, Object> environmentParameters) {
- Object oldValue = getEnvironmentParameters();
- this.environmentParameters = environmentParameters;
- firePropertyChange(PROPERTY_ENVIRONMENT_PARAMETERS, oldValue, environmentParameters);
- }
-
public boolean isFishingOperationRectiligne() {
return fishingOperationRectiligne;
}
@@ -361,4 +359,33 @@
firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur);
}
+ public Map<Object, Object> getGearShootingParameters() {
+ return gearShootingParameters;
+ }
+
+ public void setGearShootingParameters(Map<Object, Object> gearShootingParameters) {
+ Object oldValue = getGearShootingParameters();
+ this.gearShootingParameters = gearShootingParameters;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_PARAMETERS, oldValue, gearShootingParameters);
+ }
+
+ public Map<Object, Object> getEnvironmentParameters() {
+ return environmentParameters;
+ }
+
+ public void setEnvironmentParameters(Map<Object, Object> environmentParameters) {
+ Object oldValue = getEnvironmentParameters();
+ this.environmentParameters = environmentParameters;
+ firePropertyChange(PROPERTY_ENVIRONMENT_PARAMETERS, oldValue, environmentParameters);
+ }
+
+ public Map<Object, Object> getHydrologyParameters() {
+ return hydrologyParameters;
+ }
+
+ public void setHydrologyParameters(Map<Object, Object> hydrologyParameters) {
+ Object oldValue = getHydrologyParameters();
+ this.hydrologyParameters = hydrologyParameters;
+ firePropertyChange(PROPERTY_HYDROLOGY_PARAMETERS, oldValue, hydrologyParameters);
+ }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java 2012-12-19 23:24:11 UTC (rev 92)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -78,7 +78,6 @@
}
public void setValue(String value) {
- log.info(">>>>>>>>>>>>>>< setValue " + value);
Object oldValue = getValue();
this.value = value;
firePropertyChange(PROPERTY_VALUE, oldValue, value);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java 2012-12-19 23:24:11 UTC (rev 92)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -30,8 +30,6 @@
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -128,12 +126,6 @@
final JComboBox keyCombo = ui.getNewRowKey();
keyCombo.setModel(new DefaultComboBoxModel());
- keyCombo.addItemListener(new ItemListener() {
-
- public void itemStateChanged(ItemEvent e) {
- log.debug("item state changed " + e.paramString());
- }
- });
keyCombo.getModel().addListDataListener(new ListDataListener() {
public void intervalAdded(ListDataEvent e) {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java 2012-12-19 23:24:11 UTC (rev 92)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -24,11 +24,11 @@
* #L%
*/
+import com.google.common.collect.Maps;
import java.util.Map;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import java.util.HashMap;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderModelBuilder;
@@ -37,6 +37,7 @@
/**
*
* @author kmorin
+ * @since 0.3
*/
public class EnvironmentTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, EnvironmentRowModel, EnvironmentTabUIModel> {
@@ -65,7 +66,7 @@
}
public void setParameter(Object param, Object value) {
- Object oldValue = new HashMap<Object, Object>(environmentParameters);
+ Object oldValue = Maps.newLinkedHashMap(environmentParameters);
environmentParameters.put(param, value);
firePropertyChange(EditFishingOperationUIModel.PROPERTY_ENVIRONMENT_PARAMETERS, oldValue, environmentParameters);
}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java (from rev 92, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingRowModel.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -0,0 +1,62 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing.gearshooting;
+
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ *
+ * @author kmorin
+ * @since 0.3
+ */
+public class GearShootingRowModel extends AbstractTuttiBeanUIModel<Object, GearShootingRowModel> {
+
+ private static final Log log = LogFactory.getLog(GearShootingRowModel.class);
+
+ public static final String PROPERTY_KEY = "key";
+ public static final String PROPERTY_VALUE = "value";
+
+ protected static final Binder<Object, GearShootingRowModel> fromBeanBinder =
+ BinderFactory.newBinder(Object.class,
+ GearShootingRowModel.class);
+
+ protected static final Binder<GearShootingRowModel, Object> toBeanBinder =
+ BinderFactory.newBinder(GearShootingRowModel.class,
+ Object.class);
+
+ protected String key;
+
+ protected String value;
+
+ public GearShootingRowModel() {
+ super(Object.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public GearShootingRowModel(String key) {
+ this();
+ this.key = key;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ Object oldValue = getKey();
+ this.key = key;
+ firePropertyChange(PROPERTY_KEY, oldValue, key);
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ Object oldValue = getValue();
+ this.value = value;
+ firePropertyChange(PROPERTY_VALUE, oldValue, value);
+ }
+
+}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUI.css (from rev 92, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUI.css 2012-12-20 11:29:15 UTC (rev 93)
@@ -0,0 +1,29 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+#gearShootingTable {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
\ No newline at end of file
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUI.jaxx (from rev 92, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUI.jaxx 2012-12-20 11:29:15 UTC (rev 93)
@@ -0,0 +1,46 @@
+<Table implements='fr.ifremer.tutti.ui.swing.TuttiUI<GearShootingTabUIModel, GearShootingTabUIHandler>'>
+
+ <import>
+ org.jdesktop.swingx.JXTable
+ fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI
+ javax.swing.ListSelectionModel
+ java.awt.Color
+ </import>
+
+ <GearShootingTabUIHandler id='handler'
+ initializer='getContextValue(GearShootingTabUIHandler.class)'/>
+
+ <GearShootingTabUIModel id='model'
+ initializer='getContextValue(GearShootingTabUIModel.class)'/>
+
+ <row fill='both'>
+ <cell fill='both' weightx='1'>
+ <JComboBox id='newRowKey'/>
+ </cell>
+ <cell fill='both'>
+ <JButton id='addRow' actionIcon='add'
+ onActionPerformed='handler.addRow()'/>
+ </cell>
+ </row>
+ <row fill='both' weighty='1'>
+ <cell fill='both' columns='2'>
+ <JScrollPane>
+ <JXTable id='gearShootingTable'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <script><![CDATA[
+
+public GearShootingTabUI(EditFishingOperationUI parentUI) {
+ GearShootingTabUIHandler handler = new GearShootingTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+}
+
+ ]]></script>
+
+</Table>
\ No newline at end of file
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java (from rev 92, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -0,0 +1,189 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing.gearshooting;
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableColumnModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+
+/**
+ *
+ * @author kmorin
+ * @since 0.3
+ */
+public class GearShootingTabUIHandler extends AbstractTuttiTableUIHandler<GearShootingRowModel, GearShootingTabUIModel> {
+
+ private final static Log log = LogFactory.getLog(GearShootingTabUIHandler.class);
+
+ protected GearShootingTabUI ui;
+
+ public GearShootingTabUIHandler(EditFishingOperationUI parentUi, GearShootingTabUI ui) {
+ super(parentUi.getHandler().getContext(), GearShootingRowModel.PROPERTY_VALUE);
+ this.ui = ui;
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getGearShootingTable();
+ }
+
+ @Override
+ protected AbstractTuttiTableModel<GearShootingRowModel> getTableModel() {
+ return (GearShootingTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ {
+
+ addColumnToModel(columnModel, GearShootingTableModel.KEY);
+ }
+
+ {
+
+ addColumnToModel(columnModel, GearShootingTableModel.VALUE);
+ }
+
+
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(GearShootingRowModel row, String propertyName, Object oldValue, Object newValue) {
+ }
+
+ @Override
+ protected void onRowValidStateChanged(GearShootingRowModel row, Boolean oldValue, Boolean newValue) {
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(GearShootingRowModel row, Boolean oldValue, Boolean newValue) {
+ }
+
+ @Override
+ public void beforeInitUI() {
+ GearShootingTabUIModel model = new GearShootingTabUIModel();
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ GearShootingTableModel tableModel =
+ new GearShootingTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ final JComboBox keyCombo = ui.getNewRowKey();
+ keyCombo.setModel(new DefaultComboBoxModel());
+
+ keyCombo.getModel().addListDataListener(new ListDataListener() {
+
+ public void intervalAdded(ListDataEvent e) {
+ keyCombo.setEnabled(true);
+ ui.getAddRow().setEnabled(true);
+ }
+
+ public void intervalRemoved(ListDataEvent e) {
+ if (keyCombo.getItemCount() == 0) {
+ keyCombo.setEnabled(false);
+ ui.getAddRow().setEnabled(false);
+ }
+ }
+
+ public void contentsChanged(ListDataEvent e) {
+ keyCombo.setEnabled(true);
+ ui.getAddRow().setEnabled(true);
+ }
+ });
+
+ // modify the model when the user enters a value
+ ListSelectionListener listener = new TableRowModificationListener<GearShootingRowModel>(
+ tableModel, getRowMonitor()) {
+
+ @Override
+ protected void saveSelectedRow() {
+ TuttiBeanMonitor<GearShootingRowModel> monitor = getRowMonitor();
+ GearShootingRowModel row = monitor.getBean();
+ if (row != null) {
+ ui.getModel().setParameter(row.getKey(), row.getValue());
+ }
+ }
+ };
+ table.getSelectionModel().addListSelectionListener(listener);
+
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected GearShootingTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ /**
+ * Adds a row with the parameter selected in the combo box
+ */
+ public void addRow() {
+ JComboBox keyCombo = ui.getNewRowKey();
+ String key = (String) keyCombo.getSelectedItem();
+ GearShootingRowModel row = new GearShootingRowModel(key);
+ getTableModel().addNewRow(getTable().getRowCount(), row);
+ ui.getModel().setParameter(key, null);
+
+ keyCombo.removeItem(key);
+ }
+
+ /**
+ * Resets the table with the data from the database
+ */
+ public void reset() {
+ Map<Object, Object> gearShootingParameters = ui.getModel().getGearShootingParameters();
+
+ List<GearShootingRowModel> rows = Lists.newArrayList();
+ Collection<Object> params = gearShootingParameters.keySet();
+ for (Object key : gearShootingParameters.keySet()) {
+ rows.add(new GearShootingRowModel(key.toString()));
+ }
+
+ AbstractTuttiTableModel<GearShootingRowModel> tableModel = getTableModel();
+ tableModel.setRows(rows);
+
+ JComboBox keyCombo = ui.getNewRowKey();
+ DefaultComboBoxModel keyComboModel = (DefaultComboBoxModel) keyCombo.getModel();
+ keyComboModel.removeAllElements();
+ for (String param : ui.getModel().getKeys()) {
+ if (!params.contains(param)) {
+ keyComboModel.addElement(param);
+ }
+ }
+ }
+
+}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIModel.java (from rev 92, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIModel.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing.gearshooting;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.Maps;
+import java.util.Map;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+import java.util.HashMap;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderModelBuilder;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ *
+ * @author kmorin
+ * @since 0.3
+ */
+public class GearShootingTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, GearShootingRowModel, GearShootingTabUIModel> {
+
+ protected Map<Object, Object> gearShootingParameters;
+
+ public static final String KEY_START_DEPTH = "startDepth";
+ public static final String KEY_END_DEPTH = "endDepth";
+ public static final String KEY_VERTICAL_APERTURE = "verticalAperture";
+ public static final String KEY_HORIZONTAL_APERTURE = "horizontalAperture";
+ public static final String KEY_WARP_LENGTH = "warpLength";
+ public static final String KEY_ARM_LENGTH = "armLength";
+ public static final String KEY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul";
+ public static final String KEY_MEASURED_GEOMETRY = "measuredGeometry";
+
+ protected static final Binder<FishingOperation, GearShootingTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, GearShootingTabUIModel.class)
+ .toBinder();
+
+ protected static final Binder<GearShootingTabUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(GearShootingTabUIModel.class, FishingOperation.class)
+ .toBinder();
+
+ public GearShootingTabUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public Map<Object, Object> getGearShootingParameters() {
+ return gearShootingParameters;
+ }
+
+ public void setGearShootingParameters(Map<Object, Object> gearShooting) {
+ this.gearShootingParameters = gearShooting;
+ }
+
+ public void setParameter(Object param, Object value) {
+ Object oldValue = Maps.newLinkedHashMap(gearShootingParameters);
+ gearShootingParameters.put(param, value);
+ firePropertyChange(EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_PARAMETERS, oldValue, gearShootingParameters);
+ }
+
+ public String[] getKeys() {
+ return new String[] {
+ _(new String("tutti.table.fishing.gearShooting.keys." + KEY_START_DEPTH)),
+ _(new String("tutti.table.fishing.gearShooting.keys." + KEY_END_DEPTH)),
+ _(new String("tutti.table.fishing.gearShooting.keys." + KEY_HORIZONTAL_APERTURE)),
+ _(new String("tutti.table.fishing.gearShooting.keys." + KEY_VERTICAL_APERTURE)),
+ _(new String("tutti.table.fishing.gearShooting.keys." + KEY_WARP_LENGTH)),
+ _(new String("tutti.table.fishing.gearShooting.keys." + KEY_ARM_LENGTH)),
+ _(new String("tutti.table.fishing.gearShooting.keys." + KEY_SYSTEME_FERMETURE_CUL)),
+ _(new String("tutti.table.fishing.gearShooting.keys." + KEY_MEASURED_GEOMETRY)),
+ _(new String("tutti.table.fishing.gearShooting.keys." + "key3")),
+ _(new String("tutti.table.fishing.gearShooting.keys." + "key4")),
+ _(new String("tutti.table.fishing.gearShooting.keys." + "key5"))
+ };
+ }
+}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTableModel.java (from rev 92, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTableModel.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -0,0 +1,62 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing.gearshooting;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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 fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import javax.swing.table.TableColumnModel;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ *
+ * @author kmorin
+ * since 0.3
+ */
+public class GearShootingTableModel extends AbstractTuttiTableModel<GearShootingRowModel> {
+
+ public static final ColumnIdentifier<GearShootingRowModel> KEY = ColumnIdentifier.newId(
+ GearShootingRowModel.PROPERTY_KEY,
+ n_("tutti.table.fishing.gearShooting.header.key"),
+ n_("tutti.table.fishing.gearShooting.header.key"));
+
+ public static final ColumnIdentifier<GearShootingRowModel> VALUE = ColumnIdentifier.newId(
+ GearShootingRowModel.PROPERTY_VALUE,
+ n_("tutti.table.fishing.gearShooting.header.value"),
+ n_("tutti.table.fishing.gearShooting.header.value"));
+
+ public GearShootingTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols(KEY);
+ }
+
+ @Override
+ protected GearShootingRowModel createNewRow() {
+ GearShootingRowModel result = new GearShootingRowModel();
+ return result;
+ }
+
+}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java (from rev 91, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyRowModel.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -0,0 +1,88 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology;
+
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ *
+ * @author kmorin
+ * @since 0.3
+ */
+public class HydrologyRowModel extends AbstractTuttiBeanUIModel<Object, HydrologyRowModel> {
+
+ private static final Log log = LogFactory.getLog(HydrologyRowModel.class);
+
+ public static final String PROPERTY_KEY = "key";
+ public static final String PROPERTY_GEAR_SHOOTING_START_VALUE = "gearShootingStartValue";
+ public static final String PROPERTY_GEAR_SHOOTING_END_VALUE = "gearShootingEndValue";
+ public static final String PROPERTY_AVERAGE_VALUE = "averageValue";
+
+ protected static final Binder<Object, HydrologyRowModel> fromBeanBinder =
+ BinderFactory.newBinder(Object.class,
+ HydrologyRowModel.class);
+
+ protected static final Binder<HydrologyRowModel, Object> toBeanBinder =
+ BinderFactory.newBinder(HydrologyRowModel.class,
+ Object.class);
+
+ protected String key;
+
+ protected String gearShootingStartValue;
+
+ protected String gearShootingEndValue;
+
+ protected String averageValue;
+
+ public HydrologyRowModel() {
+ super(Object.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public HydrologyRowModel(String key) {
+ this();
+ this.key = key;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ Object oldValue = getKey();
+ this.key = key;
+ firePropertyChange(PROPERTY_KEY, oldValue, key);
+ }
+
+ public String getGearShootingStartValue() {
+ return gearShootingStartValue;
+ }
+
+ public void setGearShootingStartValue(String gearShootingStartValue) {
+ Object oldValue = getGearShootingStartValue();
+ this.gearShootingStartValue = gearShootingStartValue;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_VALUE, oldValue, gearShootingStartValue);
+ }
+
+ public String getGearShootingEndValue() {
+ return gearShootingEndValue;
+ }
+
+ public void setGearShootingEndValue(String gearShootingEndValue) {
+ Object oldValue = getGearShootingEndValue();
+ this.gearShootingEndValue = gearShootingEndValue;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_VALUE, oldValue, gearShootingEndValue);
+ }
+
+ public String getAverageValue() {
+ return averageValue;
+ }
+
+ public void setAverageValue(String averageValue) {
+ Object oldValue = getAverageValue();
+ this.averageValue = averageValue;
+ firePropertyChange(PROPERTY_AVERAGE_VALUE, oldValue, averageValue);
+ }
+
+}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.css (from rev 91, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.css 2012-12-20 11:29:15 UTC (rev 93)
@@ -0,0 +1,6 @@
+#hydrologyTable {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
\ No newline at end of file
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.jaxx (from rev 91, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUI.jaxx 2012-12-20 11:29:15 UTC (rev 93)
@@ -0,0 +1,46 @@
+<Table implements='fr.ifremer.tutti.ui.swing.TuttiUI<HydrologyTabUIModel, HydrologyTabUIHandler>'>
+
+ <import>
+ org.jdesktop.swingx.JXTable
+ fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI
+ javax.swing.ListSelectionModel
+ java.awt.Color
+ </import>
+
+ <HydrologyTabUIHandler id='handler'
+ initializer='getContextValue(HydrologyTabUIHandler.class)'/>
+
+ <HydrologyTabUIModel id='model'
+ initializer='getContextValue(HydrologyTabUIModel.class)'/>
+
+ <row fill='both'>
+ <cell fill='both' weightx='1'>
+ <JComboBox id='newRowKey'/>
+ </cell>
+ <cell fill='both'>
+ <JButton id='addRow' actionIcon='add'
+ onActionPerformed='handler.addRow()'/>
+ </cell>
+ </row>
+ <row fill='both' weighty='1'>
+ <cell fill='both' columns='2'>
+ <JScrollPane>
+ <JXTable id='hydrologyTable'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <script><![CDATA[
+
+public HydrologyTabUI(EditFishingOperationUI parentUI) {
+ HydrologyTabUIHandler handler = new HydrologyTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+}
+
+ ]]></script>
+
+</Table>
\ No newline at end of file
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java (from rev 91, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -0,0 +1,207 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology;
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableColumnModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+
+/**
+ *
+ * @author kmorin
+ * @since 0.3
+ */
+public class HydrologyTabUIHandler extends AbstractTuttiTableUIHandler<HydrologyRowModel, HydrologyTabUIModel> {
+
+ private final static Log log = LogFactory.getLog(HydrologyTabUIHandler.class);
+
+ protected HydrologyTabUI ui;
+
+ public HydrologyTabUIHandler(EditFishingOperationUI parentUi, HydrologyTabUI ui) {
+ super(parentUi.getHandler().getContext(),
+ HydrologyRowModel.PROPERTY_GEAR_SHOOTING_START_VALUE,
+ HydrologyRowModel.PROPERTY_AVERAGE_VALUE,
+ HydrologyRowModel.PROPERTY_GEAR_SHOOTING_END_VALUE
+ );
+ this.ui = ui;
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getHydrologyTable();
+ }
+
+ @Override
+ protected AbstractTuttiTableModel<HydrologyRowModel> getTableModel() {
+ return (HydrologyTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ {
+
+ addColumnToModel(columnModel, HydrologyTableModel.KEY);
+ }
+
+ {
+
+ addColumnToModel(columnModel, HydrologyTableModel.GEAR_SHOOTING_START_VALUE);
+ }
+
+ {
+
+ addColumnToModel(columnModel, HydrologyTableModel.AVERAGE_VALUE);
+ }
+
+ {
+
+ addColumnToModel(columnModel, HydrologyTableModel.GEAR_SHOOTING_END_VALUE);
+ }
+
+
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(HydrologyRowModel row, String propertyName, Object oldValue, Object newValue) {
+ }
+
+ @Override
+ protected void onRowValidStateChanged(HydrologyRowModel row, Boolean oldValue, Boolean newValue) {
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(HydrologyRowModel row, Boolean oldValue, Boolean newValue) {
+ }
+
+ @Override
+ public void beforeInitUI() {
+ HydrologyTabUIModel model = new HydrologyTabUIModel();
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ HydrologyTableModel tableModel =
+ new HydrologyTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ final JComboBox keyCombo = ui.getNewRowKey();
+ keyCombo.setModel(new DefaultComboBoxModel());
+
+ keyCombo.getModel().addListDataListener(new ListDataListener() {
+
+ public void intervalAdded(ListDataEvent e) {
+ keyCombo.setEnabled(true);
+ ui.getAddRow().setEnabled(true);
+ }
+
+ public void intervalRemoved(ListDataEvent e) {
+ if (keyCombo.getItemCount() == 0) {
+ keyCombo.setEnabled(false);
+ ui.getAddRow().setEnabled(false);
+ }
+ }
+
+ public void contentsChanged(ListDataEvent e) {
+ keyCombo.setEnabled(true);
+ ui.getAddRow().setEnabled(true);
+ }
+ });
+
+ // modify the model when the user enters a value
+ ListSelectionListener listener = new TableRowModificationListener<HydrologyRowModel>(
+ tableModel, getRowMonitor()) {
+
+ @Override
+ protected void saveSelectedRow() {
+ TuttiBeanMonitor<HydrologyRowModel> monitor = getRowMonitor();
+ HydrologyRowModel row = monitor.getBean();
+ if (row != null) {
+ ui.getModel().setParameter(row.getKey(),
+ row.getGearShootingStartValue(),
+ row.getGearShootingEndValue(),
+ row.getAverageValue()
+ );
+ }
+ }
+ };
+ table.getSelectionModel().addListSelectionListener(listener);
+
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected HydrologyTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ /**
+ * Adds a row with the parameter selected in the combo box
+ */
+ public void addRow() {
+ JComboBox keyCombo = ui.getNewRowKey();
+ String key = (String) keyCombo.getSelectedItem();
+ HydrologyRowModel row = new HydrologyRowModel(key);
+ getTableModel().addNewRow(getTable().getRowCount(), row);
+ ui.getModel().setParameter(key, null, null, null);
+
+ keyCombo.removeItem(key);
+ }
+
+ /**
+ * Resets the table with the data from the database
+ */
+ public void reset() {
+ Map<Object, Object> hydrologyParameters = ui.getModel().getHydrologyParameters();
+
+ List<HydrologyRowModel> rows = Lists.newArrayList();
+ Collection<Object> params = hydrologyParameters.keySet();
+ for (Object key : hydrologyParameters.keySet()) {
+ rows.add(new HydrologyRowModel(key.toString()));
+ }
+
+ AbstractTuttiTableModel<HydrologyRowModel> tableModel = getTableModel();
+ tableModel.setRows(rows);
+
+ JComboBox keyCombo = ui.getNewRowKey();
+ DefaultComboBoxModel keyComboModel = (DefaultComboBoxModel) keyCombo.getModel();
+ keyComboModel.removeAllElements();
+ for (String param : ui.getModel().getKeys()) {
+ if (!params.contains(param)) {
+ keyComboModel.addElement(param);
+ }
+ }
+ }
+
+}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java (from rev 91, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIModel.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -0,0 +1,69 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology;
+
+import com.google.common.collect.Maps;
+import java.util.Map;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIModel;
+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._;
+
+/**
+ *
+ * @author kmorin
+ * @since 0.3
+ */
+public class HydrologyTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, HydrologyRowModel, HydrologyTabUIModel> {
+
+ protected Map<Object, Object> hydrologyParameters;
+
+ public static final String GEAR_SHOOTING_START = "gearShootingStart";
+ public static final String GEAR_SHOOTING_END = "gearShootingEnd";
+ public static final String AVERAGE = "average";
+ public static final String SURFACE = "surface";
+ public static final String BOTTOM = "bottom";
+ public static final String TEMPERATURE = "temperature";
+ public static final String SALINITY = "salinity";
+
+ protected static final Binder<FishingOperation, HydrologyTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, HydrologyTabUIModel.class)
+ .toBinder();
+
+ protected static final Binder<HydrologyTabUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(HydrologyTabUIModel.class, FishingOperation.class)
+ .toBinder();
+
+ public HydrologyTabUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public Map<Object, Object> getHydrologyParameters() {
+ return hydrologyParameters;
+ }
+
+ public void setHydrologyParameters(Map<Object, Object> environmentParameters) {
+ this.hydrologyParameters = environmentParameters;
+ }
+
+ public void setParameter(Object param, Object gearShootingStartValue,
+ Object gearShootingEndValue, Object averageValue) {
+
+ Object oldValue = Maps.newLinkedHashMap(hydrologyParameters);
+ hydrologyParameters.put(param + "." + GEAR_SHOOTING_START, gearShootingStartValue);
+ hydrologyParameters.put(param + "." + GEAR_SHOOTING_END, gearShootingEndValue);
+ hydrologyParameters.put(param + "." + AVERAGE, averageValue);
+ firePropertyChange(EditFishingOperationUIModel.PROPERTY_HYDROLOGY_PARAMETERS, oldValue, hydrologyParameters);
+ }
+
+ public String[] getKeys() {
+ return new String[] {
+ _(new String("tutti.table.fishing.hydrology.keys." + TEMPERATURE + "." + SURFACE)),
+ _(new String("tutti.table.fishing.hydrology.keys." + TEMPERATURE + "." + BOTTOM)),
+ _(new String("tutti.table.fishing.hydrology.keys." + SALINITY + "." + SURFACE)),
+ _(new String("tutti.table.fishing.hydrology.keys." + SALINITY + "." + BOTTOM)),
+ _(new String("tutti.table.fishing.hydrology.keys." + "key3")),
+ _(new String("tutti.table.fishing.hydrology.keys." + "key4")),
+ _(new String("tutti.table.fishing.hydrology.keys." + "key5"))
+ };
+ }
+}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTableModel.java (from rev 91, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTableModel.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -0,0 +1,72 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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 fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import javax.swing.table.TableColumnModel;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ *
+ * @author kmorin
+ * since 0.3
+ */
+public class HydrologyTableModel extends AbstractTuttiTableModel<HydrologyRowModel> {
+
+ public static final ColumnIdentifier<HydrologyRowModel> KEY = ColumnIdentifier.newId(
+ HydrologyRowModel.PROPERTY_KEY,
+ n_("tutti.table.fishing.hydrology.header.key"),
+ n_("tutti.table.fishing.hydrology.header.key"));
+
+ public static final ColumnIdentifier<HydrologyRowModel> GEAR_SHOOTING_START_VALUE = ColumnIdentifier.newId(
+ HydrologyRowModel.PROPERTY_GEAR_SHOOTING_START_VALUE,
+ n_("tutti.table.fishing.hydrology.header.gearShootingStartValue"),
+ n_("tutti.table.fishing.hydrology.header.gearShootingStartValue"));
+
+ public static final ColumnIdentifier<HydrologyRowModel> GEAR_SHOOTING_END_VALUE = ColumnIdentifier.newId(
+ HydrologyRowModel.PROPERTY_GEAR_SHOOTING_END_VALUE,
+ n_("tutti.table.fishing.hydrology.header.gearShootingEndValue"),
+ n_("tutti.table.fishing.hydrology.header.gearShootingEndValue"));
+
+ public static final ColumnIdentifier<HydrologyRowModel> AVERAGE_VALUE = ColumnIdentifier.newId(
+ HydrologyRowModel.PROPERTY_AVERAGE_VALUE,
+ n_("tutti.table.fishing.hydrology.header.averageValue"),
+ n_("tutti.table.fishing.hydrology.header.averageValue"));
+
+ public HydrologyTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols(KEY);
+ }
+
+ @Override
+ protected HydrologyRowModel createNewRow() {
+ HydrologyRowModel result = new HydrologyRowModel();
+ return result;
+ }
+
+}
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-19 23:24:11 UTC (rev 92)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2012-12-20 11:29:15 UTC (rev 93)
@@ -114,7 +114,7 @@
// listen when bean is changed
rowMonitor.addPropertyChangeListener(TuttiBeanMonitor.PROPERTY_BEAN, new PropertyChangeListener() {
-
+
final Set<String> propertiesToSkip =
Sets.newHashSet(getRowPropertiesToIgnore());
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-19 23:24:11 UTC (rev 92)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-20 11:29:15 UTC (rev 93)
@@ -176,6 +176,30 @@
tutti.table.fishing.environment.keys.key5=Clé 5
tutti.table.fishing.environment.keys.seaState=État de la mer
tutti.table.fishing.environment.keys.windDirection=Direction du vent
+tutti.table.fishing.gearShooting.header.key=Clé
+tutti.table.fishing.gearShooting.header.value=Valeur
+tutti.table.fishing.gearShooting.keys.armLength=Longueur des bras
+tutti.table.fishing.gearShooting.keys.endDepth=Profondeur fin de traine
+tutti.table.fishing.gearShooting.keys.horizontalAperture=Ouverture horizontale
+tutti.table.fishing.gearShooting.keys.key3=Clé 3
+tutti.table.fishing.gearShooting.keys.key4=Clé 4
+tutti.table.fishing.gearShooting.keys.key5=Clé 5
+tutti.table.fishing.gearShooting.keys.measuredGeometry=Géométrie mesurée
+tutti.table.fishing.gearShooting.keys.startDepth=Profondeur début de traine
+tutti.table.fishing.gearShooting.keys.systemeFermetureCul=Système de fermeture du cul
+tutti.table.fishing.gearShooting.keys.verticalAperture=Ouverture verticale
+tutti.table.fishing.gearShooting.keys.warpLength=Longueur des funes
+tutti.table.fishing.hydrology.header.averageValue=Moyenne
+tutti.table.fishing.hydrology.header.gearShootingEndValue=Début de traîne
+tutti.table.fishing.hydrology.header.gearShootingStartValue=Fin de traîne
+tutti.table.fishing.hydrology.header.key=Clé
+tutti.table.fishing.hydrology.keys.key3=Clé 3
+tutti.table.fishing.hydrology.keys.key4=Clé 4
+tutti.table.fishing.hydrology.keys.key5=Clé 5
+tutti.table.fishing.hydrology.keys.salinity.bottom=Salinité au fond
+tutti.table.fishing.hydrology.keys.salinity.surface=Salinité à la surface
+tutti.table.fishing.hydrology.keys.temperature.bottom=Température au fond
+tutti.table.fishing.hydrology.keys.temperature.surface=Température à la surface
tutti.table.macrowaste.batch.header.comment=Commentaire
tutti.table.macrowaste.batch.header.file=Pièces jointes
tutti.table.macrowaste.batch.header.macroWasteCategory=Catégorie
1
0
Dec. 19, 2012
Author: tchemit
Date: 2012-12-20 00:24:11 +0100 (Thu, 20 Dec 2012)
New Revision: 92
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/92
Log:
- usage of Caracteristic
- remove obsolete beans
- refs #1804: Onglet captures (debut de l'?\195?\169cran)
- refs #1811: [Protocole] S?\195?\169lection d'un protocole (sauvegarde du protocol et mise ?\195?\160 jour du titre)
Added:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CaracteristicMap.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/protocol/
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel-error-validation.xml
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIModel.java
Modified:
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java
trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-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/operation/EditFishingOperationUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.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-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -34,18 +34,13 @@
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.MacroWasteCategory;
import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.SeaState;
-import fr.ifremer.tutti.persistence.entities.referential.Sex;
-import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
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;
@@ -75,20 +70,32 @@
//-- Referential methods --//
//------------------------------------------------------------------------//
- List<SortedUnsortedCategory> getAllSortedUnsortedCategory();
+ List<Species> getAllSpecies();
- List<WeightCategory> getAllWeightCategory();
+ List<FishingOperationLocation> getAllFishingOperationStrata(String zoneId);
- List<Sex> getAllSex();
+ List<FishingOperationLocation> getAllFishingOperationSubStrata(String locationId);
- List<Species> getAllSpecies();
+ List<FishingOperationLocation> getAllFishingOperationLocation(String locationId);
- List<SeaState> getAllSeaState();
+ List<Caracteristic> getAllFishingOperationEnvironmentCaracteristic();
- List<FishingOperationLocation> getAllStrata();
+ List<Caracteristic> getAllFishingOperationGearCaracteristic();
- List<BeaufortScale> getAllBeaufortScale();
+ List<Caracteristic> getAllFishingOperationHydrologicCaracteristic();
+ List<Caracteristic> getAllSpeciesFrequencyCaracteristic();
+
+ Caracteristic getSizeCategoryCaracteristic();
+
+ Caracteristic getSexCaracteristic();
+
+ Caracteristic getSortedUnsortedCaracteristic();
+
+ Caracteristic getMaturityCaracteristic();
+
+ Caracteristic getMacroWasteCategoryCaracteristic();
+
List<Zone> getAllZone();
List<Country> getAllCountry();
@@ -99,8 +106,6 @@
List<Person> getAllPerson();
- List<MacroWasteCategory> getAllMacroWasteCategory();
-
//------------------------------------------------------------------------//
//-- Program methods --//
//------------------------------------------------------------------------//
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CaracteristicMap.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CaracteristicMap.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CaracteristicMap.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -0,0 +1,39 @@
+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.Caracteristic;
+
+import java.util.HashMap;
+
+/**
+ * A map (key are {@link Caracteristic}, values are values of caracteristics).
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class CaracteristicMap extends HashMap<Caracteristic, Object> {
+ private static final long serialVersionUID = 1L;
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CaracteristicMap.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -31,6 +31,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import fr.ifremer.tutti.persistence.entities.data.FishingOperationAware;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import java.util.Collection;
import java.util.Collections;
@@ -84,6 +85,10 @@
return new TraitIdPredicate<B>(id);
}
+ public static Predicate<Caracteristic> newCaracteristicCategoryPredicate(String cateogryId) {
+ return new CaracteristicCategoryPredicate(cateogryId);
+ }
+
public static <B extends IdAware> B findById(Iterable<B> beans,
String id) {
B result = Iterables.tryFind(beans, newIdPredicate(id)).orNull();
@@ -104,6 +109,20 @@
}
}
+ protected static class CaracteristicCategoryPredicate implements Predicate<Caracteristic> {
+
+ private final String id;
+
+ public CaracteristicCategoryPredicate(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public boolean apply(Caracteristic input) {
+ return id.equals(input.getCategory());
+ }
+ }
+
protected static class TraitIdPredicate<B extends FishingOperationAware> implements Predicate<B> {
private final String id;
Modified: trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
===================================================================
--- trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-19 23:24:11 UTC (rev 92)
@@ -9,18 +9,12 @@
fr.ifremer.tutti.persistence.entities.data.SpeciesBatch
fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency
fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol
-fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue
fr.ifremer.tutti.persistence.entities.referential.Country
fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation
fr.ifremer.tutti.persistence.entities.referential.Gear
-fr.ifremer.tutti.persistence.entities.referential.MacroWasteCategory
-fr.ifremer.tutti.persistence.entities.referential.MeasurementCaracteristic
+fr.ifremer.tutti.persistence.entities.referential.Caracteristic
fr.ifremer.tutti.persistence.entities.referential.Person
-fr.ifremer.tutti.persistence.entities.referential.SeaState
-fr.ifremer.tutti.persistence.entities.referential.Sex
-fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory
fr.ifremer.tutti.persistence.entities.referential.Species
fr.ifremer.tutti.persistence.entities.referential.Vessel
-fr.ifremer.tutti.persistence.entities.referential.WeightCategory
fr.ifremer.tutti.persistence.entities.referential.Zone
\ No newline at end of file
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties
===================================================================
--- trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties 2012-12-19 23:24:11 UTC (rev 92)
@@ -34,8 +34,11 @@
fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.vessel.stereotype=ordered
fr.ifremer.tutti.persistence.entities.data.FishingOperation.attribute.saisisseur.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch.attribute.macroWasteCategory.stereotype=ordered
+
fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.gearPmfmId.stereotype=ordered
fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.environmentPmfmId.stereotype=ordered
fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.hydrologyPmfmId.stereotype=ordered
fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.species.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.referential.Caracteristic.attribute.qualitativeValue.stereotype=ordered
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -35,18 +35,13 @@
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.MacroWasteCategory;
import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.SeaState;
-import fr.ifremer.tutti.persistence.entities.referential.Sex;
-import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
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.nuiton.util.ApplicationConfig;
@@ -91,70 +86,95 @@
//------------------------------------------------------------------------//
@Override
- public List<SortedUnsortedCategory> getAllSortedUnsortedCategory() {
+ public List<Species> getAllSpecies() {
return null;
}
@Override
- public List<WeightCategory> getAllWeightCategory() {
+ public List<FishingOperationLocation> getAllFishingOperationStrata(String zoneId) {
return null;
}
@Override
- public List<Sex> getAllSex() {
+ public List<FishingOperationLocation> getAllFishingOperationSubStrata(String locationId) {
return null;
}
@Override
- public List<Species> getAllSpecies() {
+ public List<FishingOperationLocation> getAllFishingOperationLocation(String locationId) {
return null;
}
@Override
- public List<SeaState> getAllSeaState() {
+ public List<Zone> getAllZone() {
return null;
}
@Override
- public List<FishingOperationLocation> getAllStrata() {
+ public List<Country> getAllCountry() {
return null;
}
@Override
- public List<BeaufortScale> getAllBeaufortScale() {
+ public List<Vessel> getAllVessel() {
return null;
}
@Override
- public List<Zone> getAllZone() {
+ public List<Gear> getAllGear() {
return null;
}
@Override
- public List<Country> getAllCountry() {
+ public List<Person> getAllPerson() {
return null;
}
@Override
- public List<Vessel> getAllVessel() {
+ public List<Caracteristic> getAllFishingOperationEnvironmentCaracteristic() {
return null;
}
@Override
- public List<Gear> getAllGear() {
+ public List<Caracteristic> getAllFishingOperationGearCaracteristic() {
return null;
}
@Override
- public List<Person> getAllPerson() {
+ public List<Caracteristic> getAllFishingOperationHydrologicCaracteristic() {
return null;
}
@Override
- public List<MacroWasteCategory> getAllMacroWasteCategory() {
+ public List<Caracteristic> getAllSpeciesFrequencyCaracteristic() {
return null;
}
+ @Override
+ public Caracteristic getSizeCategoryCaracteristic() {
+ return null;
+ }
+
+ @Override
+ public Caracteristic getSexCaracteristic() {
+ return null;
+ }
+
+ @Override
+ public Caracteristic getSortedUnsortedCaracteristic() {
+ return null;
+ }
+
+ @Override
+ public Caracteristic getMaturityCaracteristic() {
+ return null;
+ }
+
+ @Override
+ public Caracteristic getMacroWasteCategoryCaracteristic() {
+ return null;
+ }
+
//------------------------------------------------------------------------//
//-- Program methods --//
//------------------------------------------------------------------------//
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-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -25,24 +25,24 @@
*/
import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.entities.IdAware;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.MacroWasteCategory;
import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.SeaState;
-import fr.ifremer.tutti.persistence.entities.referential.Sex;
-import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
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.ArrayList;
import java.util.List;
import java.util.UUID;
+import static fr.ifremer.tutti.persistence.TuttiPersistenceDevImpl.CaracteristicEnum;
+
/**
* TODO
*
@@ -59,17 +59,99 @@
cache = ArrayListMultimap.create();
- Zone b;
- b = new Zone();
- b.setId(UUID.randomUUID().toString());
- b.setName("zone1");
- cache.put(Zone.class, b);
+ Zone z;
+ z = new Zone();
+ z.setId(UUID.randomUUID().toString());
+ z.setName("zone1");
+ cache.put(Zone.class, z);
- b = new Zone();
- b.setId(UUID.randomUUID().toString());
- b.setName("zone2");
- cache.put(Zone.class, b);
+ FishingOperationLocation l;
+ FishingOperationLocation sl;
+ FishingOperationLocation ssl;
+ l = new FishingOperationLocation();
+ l.setId(UUID.randomUUID().toString());
+ l.setName("zone1 - strata1");
+ l.setZone(z);
+ cache.put(FishingOperationLocation.class, l);
+
+ sl = new FishingOperationLocation();
+ sl.setId(UUID.randomUUID().toString());
+ sl.setName("strat1 - substrata1");
+ sl.setParent(l);
+ cache.put(FishingOperationLocation.class, sl);
+
+ ssl = new FishingOperationLocation();
+ ssl.setId(UUID.randomUUID().toString());
+ ssl.setName("substrata1 - localite1");
+ ssl.setLocalite(true);
+ ssl.setParent(sl);
+ cache.put(FishingOperationLocation.class, ssl);
+
+ ssl = new FishingOperationLocation();
+ ssl.setId(UUID.randomUUID().toString());
+ ssl.setName("substrata1 - localite2");
+ ssl.setLocalite(true);
+ ssl.setParent(sl);
+ cache.put(FishingOperationLocation.class, ssl);
+
+ sl = new FishingOperationLocation();
+ sl.setId(UUID.randomUUID().toString());
+ sl.setName("strat1 - substrata2");
+ sl.setParent(l);
+ cache.put(FishingOperationLocation.class, sl);
+
+ ssl = new FishingOperationLocation();
+ ssl.setId(UUID.randomUUID().toString());
+ ssl.setName("substrata2 - localite1");
+ ssl.setLocalite(true);
+ ssl.setParent(sl);
+ cache.put(FishingOperationLocation.class, ssl);
+
+ ssl = new FishingOperationLocation();
+ ssl.setId(UUID.randomUUID().toString());
+ ssl.setName("substrata2 - localite2");
+ ssl.setLocalite(true);
+ ssl.setParent(sl);
+ cache.put(FishingOperationLocation.class, ssl);
+
+ l = new FishingOperationLocation();
+ l.setId(UUID.randomUUID().toString());
+ l.setName("zone1 - strata2");
+ l.setZone(z);
+ cache.put(FishingOperationLocation.class, l);
+
+ ssl = new FishingOperationLocation();
+ ssl.setId(UUID.randomUUID().toString());
+ ssl.setName("strata2 - localite1");
+ ssl.setParent(l);
+ ssl.setLocalite(true);
+ cache.put(FishingOperationLocation.class, ssl);
+
+ ssl = new FishingOperationLocation();
+ ssl.setId(UUID.randomUUID().toString());
+ ssl.setName("strata2 - localite2");
+ ssl.setParent(l);
+ ssl.setLocalite(true);
+ cache.put(FishingOperationLocation.class, ssl);
+
+ z = new Zone();
+ z.setId(UUID.randomUUID().toString());
+ z.setName("zone2");
+ cache.put(Zone.class, z);
+
+ l = new FishingOperationLocation();
+ l.setId(UUID.randomUUID().toString());
+ l.setName("zone2 - strata1");
+ l.setZone(z);
+ cache.put(FishingOperationLocation.class, l);
+
+ l = new FishingOperationLocation();
+ l.setId(UUID.randomUUID().toString());
+ l.setName("zone2 - strata2");
+ l.setZone(z);
+ cache.put(FishingOperationLocation.class, l);
+
Country c;
c = new Country();
c.setId(UUID.randomUUID().toString());
@@ -151,60 +233,80 @@
u.setLastName("Brisset");
cache.put(Person.class, u);
- BeaufortScale bs;
+ Caracteristic ca;
- bs = new BeaufortScale();
- bs.setId(UUID.randomUUID().toString());
- bs.setName("Calme");
- cache.put(BeaufortScale.class, bs);
+ ca = createQuantitativeCaracteristic("Beaufort Scale",
+ CaracteristicEnum.FishingOperationEnvironment.name());
- bs = new BeaufortScale();
- bs.setId(UUID.randomUUID().toString());
- bs.setName("Très légère brise");
- cache.put(BeaufortScale.class, bs);
+ createCaracteristicQuantitativeValue(ca, "Calme");
+ createCaracteristicQuantitativeValue(ca, "Très légère brise");
+ createCaracteristicQuantitativeValue(ca, "Petite brise");
+ createCaracteristicQuantitativeValue(ca, "Jolie brise");
+ createCaracteristicQuantitativeValue(ca, "Vent frais");
+ createCaracteristicQuantitativeValue(ca, "Grand frais");
+ createCaracteristicQuantitativeValue(ca, "Coup de vent");
+ createCaracteristicQuantitativeValue(ca, "Fort coup de vent");
- bs = new BeaufortScale();
- bs.setId(UUID.randomUUID().toString());
- bs.setName("Petite brise");
- cache.put(BeaufortScale.class, bs);
+ cache.put(Caracteristic.class, ca);
- bs = new BeaufortScale();
- bs.setId(UUID.randomUUID().toString());
- bs.setName("Jolie brise");
- cache.put(BeaufortScale.class, bs);
+ ca = createQuantitativeCaracteristic("Sea State",
+ CaracteristicEnum.FishingOperationEnvironment.name());
- bs = new BeaufortScale();
- bs.setId(UUID.randomUUID().toString());
- bs.setName("Vent frais");
- cache.put(BeaufortScale.class, bs);
+ createCaracteristicQuantitativeValue(ca, "Mer calme");
+ createCaracteristicQuantitativeValue(ca, "Mer agitée");
+ cache.put(Caracteristic.class, ca);
- bs = new BeaufortScale();
- bs.setId(UUID.randomUUID().toString());
- bs.setName("Grand frais");
- cache.put(BeaufortScale.class, bs);
+ createNumberCaracteristic("Wind direction",
+ CaracteristicEnum.FishingOperationEnvironment.name());
- bs = new BeaufortScale();
- bs.setId(UUID.randomUUID().toString());
- bs.setName("Coup de vent");
- cache.put(BeaufortScale.class, bs);
+ createNumberCaracteristic("Gear Shooting Start Depth",
+ CaracteristicEnum.FishingOperationEnvironment.name());
- bs = new BeaufortScale();
- bs.setId(UUID.randomUUID().toString());
- bs.setName("Fort coup de vent");
- cache.put(BeaufortScale.class, bs);
+ createNumberCaracteristic("Gear Shooting End Depth",
+ CaracteristicEnum.FishingOperationEnvironment.name());
- SeaState st;
+ createNumberCaracteristic("Ouverture horizontale",
+ CaracteristicEnum.FishingOperationGear.name());
+ createNumberCaracteristic("Ouverture verticale",
+ CaracteristicEnum.FishingOperationGear.name());
+ createNumberCaracteristic("Longueur funes",
+ CaracteristicEnum.FishingOperationGear.name());
+ createNumberCaracteristic("Longueur bras",
+ CaracteristicEnum.FishingOperationGear.name());
+ createBooleanCaracteristic("Systeme cul ferme",
+ CaracteristicEnum.FishingOperationGear.name());
+ createBooleanCaracteristic("Géométrie mesurée",
+ CaracteristicEnum.FishingOperationGear.name());
- st = new SeaState();
- st.setId(UUID.randomUUID().toString());
- st.setName("Mer calme");
- cache.put(SeaState.class, st);
+ createNumberCaracteristic("Gear Shooting Start Surface Temperature",
+ CaracteristicEnum.FishingOperationHydrologic.name());
+ createNumberCaracteristic("Gear Shooting End Surface Temperature",
+ CaracteristicEnum.FishingOperationHydrologic.name());
+ createNumberCaracteristic("Average Surface Temperature",
+ CaracteristicEnum.FishingOperationHydrologic.name());
- st = new SeaState();
- st.setId(UUID.randomUUID().toString());
- st.setName("Mer agitée");
- cache.put(SeaState.class, st);
+ createNumberCaracteristic("Gear Shooting Start Bottom Temperature",
+ CaracteristicEnum.FishingOperationHydrologic.name());
+ createNumberCaracteristic("Gear Shooting End Bottom Temperature",
+ CaracteristicEnum.FishingOperationHydrologic.name());
+ createNumberCaracteristic("Average Bottom Temperature",
+ CaracteristicEnum.FishingOperationHydrologic.name());
+ createNumberCaracteristic("Gear Shooting Start Surface Salinity",
+ CaracteristicEnum.FishingOperationHydrologic.name());
+ createNumberCaracteristic("Gear Shooting End Surface Salinity",
+ CaracteristicEnum.FishingOperationHydrologic.name());
+ createNumberCaracteristic("Average Surface Salinity",
+ CaracteristicEnum.FishingOperationHydrologic.name());
+
+ createNumberCaracteristic("Gear Shooting Start Bottom Salinity",
+ CaracteristicEnum.FishingOperationHydrologic.name());
+ createNumberCaracteristic("Gear Shooting End Bottom Salinity",
+ CaracteristicEnum.FishingOperationHydrologic.name());
+ createNumberCaracteristic("Average Bottom Salinity",
+ CaracteristicEnum.FishingOperationHydrologic.name());
+
+
Species sp;
sp = new Species();
@@ -231,122 +333,86 @@
sp.setGenusSpecies("Limande");
cache.put(Species.class, sp);
- Sex se;
- se = new Sex();
- se.setId(UUID.randomUUID().toString());
- se.setName("Male");
- cache.put(Sex.class, se);
+ ca = createQuantitativeCaracteristic("MacroWaste", CaracteristicEnum.MacroWasteCategory.name());
- se = new Sex();
- se.setId(UUID.randomUUID().toString());
- se.setName("Femelle");
- cache.put(Sex.class, se);
+ createCaracteristicQuantitativeValue(ca, "Pneu");
+ createCaracteristicQuantitativeValue(ca, "Plastique");
+ createCaracteristicQuantitativeValue(ca, "Machine à laver");
+ createCaracteristicQuantitativeValue(ca, "Métal");
- se = new Sex();
- se.setId(UUID.randomUUID().toString());
- se.setName("Indéterminé");
- cache.put(Sex.class, se);
+ ca = createQuantitativeCaracteristic("Sorted / Unsorted Category", CaracteristicEnum.SpeciesSortedUnsorted.name());
- WeightCategory wc;
+ createCaracteristicQuantitativeValue(ca, "Vrac");
+ createCaracteristicQuantitativeValue(ca, "Hors Vrac");
- wc = new WeightCategory();
- wc.setId(UUID.randomUUID().toString());
- wc.setName("Petit");
- cache.put(WeightCategory.class, wc);
+ ca = createQuantitativeCaracteristic("Species Sex Category", CaracteristicEnum.SpeciesSex.name());
- wc = new WeightCategory();
- wc.setId(UUID.randomUUID().toString());
- wc.setName("Gros");
- cache.put(WeightCategory.class, wc);
+ createCaracteristicQuantitativeValue(ca, "Male");
+ createCaracteristicQuantitativeValue(ca, "Female");
+ createCaracteristicQuantitativeValue(ca, "Unknown");
- SortedUnsortedCategory suc;
+ ca = createQuantitativeCaracteristic("Species Maturity Category", CaracteristicEnum.SpeciesMaturity.name());
- suc = new SortedUnsortedCategory();
- suc.setId(UUID.randomUUID().toString());
- suc.setName("Vrac");
- cache.put(SortedUnsortedCategory.class, suc);
+ createCaracteristicQuantitativeValue(ca, "0");
+ createCaracteristicQuantitativeValue(ca, "1");
+ createCaracteristicQuantitativeValue(ca, "2");
- suc = new SortedUnsortedCategory();
- suc.setId(UUID.randomUUID().toString());
- suc.setName("Hors Vrac");
- cache.put(SortedUnsortedCategory.class, suc);
+ ca = createQuantitativeCaracteristic("Species Size Category", CaracteristicEnum.SpeciesSizeCategory.name());
- MacroWasteCategory mwc;
+ createCaracteristicQuantitativeValue(ca, "Petit");
+ createCaracteristicQuantitativeValue(ca, "Gros");
- mwc = new MacroWasteCategory();
- mwc.setId(UUID.randomUUID().toString());
- mwc.setName("Pneu");
- cache.put(MacroWasteCategory.class, mwc);
-
- mwc = new MacroWasteCategory();
- mwc.setId(UUID.randomUUID().toString());
- mwc.setName("Plastique");
- cache.put(MacroWasteCategory.class, mwc);
-
- mwc = new MacroWasteCategory();
- mwc.setId(UUID.randomUUID().toString());
- mwc.setName("Machine à laver");
- cache.put(MacroWasteCategory.class, mwc);
-
- mwc = new MacroWasteCategory();
- mwc.setId(UUID.randomUUID().toString());
- mwc.setName("Métal");
- cache.put(MacroWasteCategory.class, mwc);
}
- public List<Zone> zone() {
- return getData(Zone.class);
+ protected void createCaracteristicQuantitativeValue(Caracteristic ca, String name) {
+ CaracteristicQualitativeValue cqv = new CaracteristicQualitativeValue();
+ cqv.setId(UUID.randomUUID().toString());
+ cqv.setName(name);
+ ca.addQualitativeValue(cqv);
+ cache.put(CaracteristicQualitativeValue.class, cqv);
}
- public List<Country> country() {
- return getData(Country.class);
+ protected Caracteristic createQuantitativeCaracteristic(String name, String category) {
+ Caracteristic ca = new Caracteristic();
+ ca.setId(UUID.randomUUID().toString());
+ ca.setName(name);
+ ca.setCategory(category);
+ ca.setQualitativeType(true);
+ ca.setQualitativeValue(Lists.<CaracteristicQualitativeValue>newArrayList());
+ cache.put(Caracteristic.class, ca);
+ return ca;
}
-
- public List<Vessel> vessel() {
- return getData(Vessel.class);
+ protected Caracteristic createBooleanCaracteristic(String name, String category) {
+ Caracteristic ca = new Caracteristic();
+ ca.setId(UUID.randomUUID().toString());
+ ca.setName(name);
+ ca.setCategory(category);
+ ca.setBooleanType(true);
+ cache.put(Caracteristic.class, ca);
+ return ca;
}
- public List<Gear> gear() {
- return getData(Gear.class);
+ protected Caracteristic createNumberCaracteristic(String name, String category) {
+ Caracteristic ca = new Caracteristic();
+ ca.setId(UUID.randomUUID().toString());
+ ca.setName(name);
+ ca.setCategory(category);
+ ca.setNumberType(true);
+ cache.put(Caracteristic.class, ca);
+ return ca;
}
- public List<Person> user() {
- return getData(Person.class);
+ protected Caracteristic createTextCaracteristic(String name, String category) {
+ Caracteristic ca = new Caracteristic();
+ ca.setId(UUID.randomUUID().toString());
+ ca.setName(name);
+ ca.setCategory(category);
+ ca.setTextType(true);
+ cache.put(Caracteristic.class, ca);
+ return ca;
}
- public List<FishingOperationLocation> strata() {
- return getData(FishingOperationLocation.class);
- }
-
- public List<SeaState> seaState() {
- return getData(SeaState.class);
- }
-
- public List<BeaufortScale> beaufortScale() {
- return getData(BeaufortScale.class);
- }
-
- public List<Species> species() {
- return getData(Species.class);
- }
-
- public List<Sex> sex() {
- return getData(Sex.class);
- }
-
- public List<WeightCategory> weightCategory() {
- return getData(WeightCategory.class);
- }
-
- public List<SortedUnsortedCategory> sortedUnsortedCategory() {
- return getData(SortedUnsortedCategory.class);
- }
-
- public List<MacroWasteCategory> macroWasteCategory() {
- return getData(MacroWasteCategory.class);
- }
-
public <B extends IdAware> 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-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -46,18 +46,13 @@
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.MacroWasteCategory;
import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.SeaState;
-import fr.ifremer.tutti.persistence.entities.referential.Sex;
-import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
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;
@@ -109,6 +104,18 @@
}
}
+ enum CaracteristicEnum {
+ FishingOperationEnvironment,
+ FishingOperationGear,
+ FishingOperationHydrologic,
+ SpeciesFrequency,
+ SpeciesSizeCategory,
+ SpeciesSex,
+ SpeciesSortedUnsorted,
+ SpeciesMaturity,
+ MacroWasteCategory
+ }
+
/**
* Persistence config.
*
@@ -174,26 +181,6 @@
//------------------------------------------------------------------------//
@Override
- public List<SortedUnsortedCategory> getAllSortedUnsortedCategory() {
- List<SortedUnsortedCategory> result =
- getDataInNewList(SortedUnsortedCategory.class);
- return result;
- }
-
- @Override
- public List<WeightCategory> getAllWeightCategory() {
- List<WeightCategory> result =
- getDataInNewList(WeightCategory.class);
- return result;
- }
-
- @Override
- public List<Sex> getAllSex() {
- List<Sex> result = getDataInNewList(Sex.class);
- return result;
- }
-
- @Override
public List<Species> getAllSpecies() {
List<Species> result = getDataInNewList(Species.class);
return result;
@@ -230,31 +217,86 @@
}
@Override
- public List<MacroWasteCategory> getAllMacroWasteCategory() {
- List<MacroWasteCategory> result =
- getDataInNewList(MacroWasteCategory.class);
+ public List<FishingOperationLocation> getAllFishingOperationStrata(final String zoneId) {
+ List<FishingOperationLocation> result = Lists.newArrayList(Iterables.filter(getData(FishingOperationLocation.class), new Predicate<FishingOperationLocation>() {
+ @Override
+ public boolean apply(FishingOperationLocation input) {
+ Zone zone = input.getZone();
+ return zone != null && zoneId.equals(zone.getId());
+ }
+ }));
return result;
}
@Override
- public List<SeaState> getAllSeaState() {
- List<SeaState> result = getDataInNewList(SeaState.class);
+ public List<FishingOperationLocation> getAllFishingOperationSubStrata(final String locationId) {
+ List<FishingOperationLocation> result = Lists.newArrayList(Iterables.filter(getData(FishingOperationLocation.class), new Predicate<FishingOperationLocation>() {
+ @Override
+ public boolean apply(FishingOperationLocation input) {
+ FishingOperationLocation parent = input.getParent();
+ return parent != null && !input.isLocalite() && locationId.equals(parent.getId());
+ }
+ }));
return result;
}
@Override
- public List<FishingOperationLocation> getAllStrata() {
- List<FishingOperationLocation> result = getDataInNewList(FishingOperationLocation.class);
+ public List<FishingOperationLocation> getAllFishingOperationLocation(final String locationId) {
+ List<FishingOperationLocation> result = Lists.newArrayList(Iterables.filter(getData(FishingOperationLocation.class), new Predicate<FishingOperationLocation>() {
+ @Override
+ public boolean apply(FishingOperationLocation input) {
+ FishingOperationLocation parent = input.getParent();
+ return parent != null && input.isLocalite() && locationId.equals(parent.getId());
+ }
+ }));
return result;
}
@Override
- public List<BeaufortScale> getAllBeaufortScale() {
- List<BeaufortScale> result =
- getDataInNewList(BeaufortScale.class);
- return result;
+ public List<Caracteristic> getAllFishingOperationEnvironmentCaracteristic() {
+ return getAllCaracteristicByCategory(CaracteristicEnum.FishingOperationEnvironment.name());
}
+ @Override
+ public List<Caracteristic> getAllFishingOperationGearCaracteristic() {
+ return getAllCaracteristicByCategory(CaracteristicEnum.FishingOperationGear.name());
+ }
+
+ @Override
+ public List<Caracteristic> getAllFishingOperationHydrologicCaracteristic() {
+ return getAllCaracteristicByCategory(CaracteristicEnum.FishingOperationHydrologic.name());
+ }
+
+ @Override
+ public List<Caracteristic> getAllSpeciesFrequencyCaracteristic() {
+ return getAllCaracteristicByCategory(CaracteristicEnum.SpeciesFrequency.name());
+ }
+
+ @Override
+ public Caracteristic getSizeCategoryCaracteristic() {
+ return getCaracteristicByCategory(CaracteristicEnum.SpeciesSizeCategory.name());
+ }
+
+ @Override
+ public Caracteristic getSexCaracteristic() {
+ return getCaracteristicByCategory(CaracteristicEnum.SpeciesSex.name());
+ }
+
+ @Override
+ public Caracteristic getSortedUnsortedCaracteristic() {
+ return getCaracteristicByCategory(CaracteristicEnum.SpeciesSortedUnsorted.name());
+ }
+
+ @Override
+ public Caracteristic getMaturityCaracteristic() {
+ return getCaracteristicByCategory(CaracteristicEnum.SpeciesMaturity.name());
+ }
+
+ @Override
+ public Caracteristic getMacroWasteCategoryCaracteristic() {
+ return getCaracteristicByCategory(CaracteristicEnum.MacroWasteCategory.name());
+ }
+
//------------------------------------------------------------------------//
//-- Program methods --//
//------------------------------------------------------------------------//
@@ -780,6 +822,25 @@
return result;
}
+ protected List<Caracteristic> getAllCaracteristicByCategory(String categoryId) {
+ Predicate<Caracteristic> predicate = TuttiEntities.newCaracteristicCategoryPredicate(categoryId);
+ List<Caracteristic> result = Lists.newArrayList(Iterables.filter(getData(Caracteristic.class), predicate));
+ return result;
+ }
+
+ protected Caracteristic getCaracteristicByCategory(String categoryId) {
+ Predicate<Caracteristic> predicate = TuttiEntities.newCaracteristicCategoryPredicate(categoryId);
+ List<Caracteristic> data = getData(Caracteristic.class);
+ Caracteristic result = null;
+ for (Caracteristic caracteristic : data) {
+ if (predicate.apply(caracteristic)) {
+ result = caracteristic;
+ break;
+ }
+ }
+ return result;
+ }
+
protected <B extends IdAware> B create(Class<B> type, B bean) {
Preconditions.checkNotNull(bean, "Can't persist a null bean");
B result = TuttiEntities.newEntity(bean);
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-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -26,9 +26,10 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.config.TuttiPersistenceDevConfig;
+import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -97,7 +98,8 @@
Assert.assertTrue(storageDirectory.exists());
TuttiPersistenceDevFixtures fixtures = new TuttiPersistenceDevFixtures();
- Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaState().size());
+ Assert.assertEquals(fixtures.getData(Country.class).size(),
+ persistence.getAllCountry().size());
}
@Test
@@ -110,12 +112,13 @@
persistence.open(config.getConfig());
TuttiPersistenceDevFixtures fixtures = new TuttiPersistenceDevFixtures();
- Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaState().size());
+ Assert.assertEquals(fixtures.getData(Country.class).size(),
+ persistence.getAllCountry().size());
persistence.close();
Assert.assertTrue(storageDirectory.exists());
- Assert.assertEquals(fixtures.seaState().size(),
- persistence.getAllSeaState().size());
+ Assert.assertEquals(fixtures.getData(Country.class).size(),
+ persistence.getAllCountry().size());
}
@Test
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-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -29,18 +29,14 @@
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.MacroWasteCategory;
import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.SeaState;
-import fr.ifremer.tutti.persistence.entities.referential.Sex;
-import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
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;
@@ -99,17 +95,12 @@
registerMultiJXPathDecorator(Country.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(Gear.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(Person.class, "${firstName}$s#${lastName}$s", SEPARATOR, " ");
- registerMultiJXPathDecorator(BeaufortScale.class, "${name}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(SeaState.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(FishingOperationLocation.class, "${name}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(Sex.class, "${name}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(SortedUnsortedCategory.class, "${name}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(MacroWasteCategory.class, "${name}$s", SEPARATOR, " - ");
+ registerMultiJXPathDecorator(Caracteristic.class, "${name}$s", SEPARATOR, " - ");
+ registerMultiJXPathDecorator(CaracteristicQualitativeValue.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(Species.class, "${codeMemo}$s#${genusSpecies}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(Species.class, SPECIES_BY_CODE, "${codeMemo}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(Species.class, SPECIES_BY_GENUS, "${genusSpecies}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(WeightCategory.class, BY_NAME, "${name}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(Sex.class, BY_NAME, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(Attachment.class, "${name}$s", SEPARATOR, " - ");
}
};
@@ -130,8 +121,6 @@
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-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -36,18 +36,13 @@
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.MacroWasteCategory;
import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.SeaState;
-import fr.ifremer.tutti.persistence.entities.referential.Sex;
-import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
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;
@@ -136,24 +131,6 @@
//------------------------------------------------------------------------//
@Override
- public List<SortedUnsortedCategory> getAllSortedUnsortedCategory() {
- checkDriverExists();
- return driver.getAllSortedUnsortedCategory();
- }
-
- @Override
- public List<WeightCategory> getAllWeightCategory() {
- checkDriverExists();
- return driver.getAllWeightCategory();
- }
-
- @Override
- public List<Sex> getAllSex() {
- checkDriverExists();
- return driver.getAllSex();
- }
-
- @Override
public List<Species> getAllSpecies() {
checkDriverExists();
return driver.getAllSpecies();
@@ -190,29 +167,77 @@
}
@Override
- public List<MacroWasteCategory> getAllMacroWasteCategory() {
+ public List<FishingOperationLocation> getAllFishingOperationStrata(String zoneId) {
checkDriverExists();
- return driver.getAllMacroWasteCategory();
+ return driver.getAllFishingOperationStrata(zoneId);
}
@Override
- public List<SeaState> getAllSeaState() {
+ public List<FishingOperationLocation> getAllFishingOperationSubStrata(String locationId) {
checkDriverExists();
- return driver.getAllSeaState();
+ return driver.getAllFishingOperationSubStrata(locationId);
}
@Override
- public List<FishingOperationLocation> getAllStrata() {
+ public List<FishingOperationLocation> getAllFishingOperationLocation(String locationId) {
checkDriverExists();
- return driver.getAllStrata();
+ return driver.getAllFishingOperationLocation(locationId);
}
@Override
- public List<BeaufortScale> getAllBeaufortScale() {
+ public List<Caracteristic> getAllFishingOperationEnvironmentCaracteristic() {
checkDriverExists();
- return driver.getAllBeaufortScale();
+ return driver.getAllFishingOperationEnvironmentCaracteristic();
}
+ @Override
+ public List<Caracteristic> getAllFishingOperationGearCaracteristic() {
+ checkDriverExists();
+ return driver.getAllFishingOperationGearCaracteristic();
+ }
+
+ @Override
+ public List<Caracteristic> getAllFishingOperationHydrologicCaracteristic() {
+ checkDriverExists();
+ return driver.getAllFishingOperationHydrologicCaracteristic();
+ }
+
+ @Override
+ public List<Caracteristic> getAllSpeciesFrequencyCaracteristic() {
+ checkDriverExists();
+ return driver.getAllSpeciesFrequencyCaracteristic();
+ }
+
+ @Override
+ public Caracteristic getSizeCategoryCaracteristic() {
+ checkDriverExists();
+ return driver.getSizeCategoryCaracteristic();
+ }
+
+ @Override
+ public Caracteristic getSexCaracteristic() {
+ checkDriverExists();
+ return driver.getSexCaracteristic();
+ }
+
+ @Override
+ public Caracteristic getSortedUnsortedCaracteristic() {
+ checkDriverExists();
+ return driver.getSortedUnsortedCaracteristic();
+ }
+
+ @Override
+ public Caracteristic getMaturityCaracteristic() {
+ checkDriverExists();
+ return driver.getMaturityCaracteristic();
+ }
+
+ @Override
+ public Caracteristic getMacroWasteCategoryCaracteristic() {
+ checkDriverExists();
+ return driver.getMacroWasteCategoryCaracteristic();
+ }
+
//------------------------------------------------------------------------//
//-- Program methods --//
//------------------------------------------------------------------------//
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-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -35,7 +35,7 @@
import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUI;
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.content.program.EditProgramUI;
-import fr.ifremer.tutti.ui.swing.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.AboutPanel;
@@ -83,8 +83,7 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
- if (propertyName.equals(TuttiUIContext.PROPERTY_PROGRAM_ID) ||
- propertyName.equals(TuttiUIContext.PROPERTY_CRUISE_ID)) {
+ if (TuttiUIContext.ID_TO_SAVE_PROPERTIES.contains(propertyName)) {
// change the ui title
changeTitle();
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-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -28,6 +28,7 @@
import com.google.common.collect.Sets;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.TuttiService;
import fr.ifremer.tutti.service.TuttiServiceContext;
@@ -61,6 +62,12 @@
public static final String PROPERTY_PROTOCOL_ID = "protocolId";
+ public static final Set<String> ID_TO_SAVE_PROPERTIES = Sets.newHashSet(
+ PROPERTY_PROGRAM_ID,
+ PROPERTY_CRUISE_ID,
+ PROPERTY_PROTOCOL_ID);
+
+
public static final String PROPERTY_SCREEN = "screen";
public static final String PROPERTY_CRUISE_CONTEXT_FILLED = "cruiseContextFilled";
@@ -196,7 +203,6 @@
// always propagate the change
firePropertyChange(PROPERTY_PROTOCOL_ID, null, protocolId);
-
}
public void setScreen(TuttiScreen screen) {
@@ -219,22 +225,44 @@
setCruiseId(getConfig().getCruiseId());
}
+ if (protocolId == null) {
+
+ // load it from config
+ setProtocolId(getConfig().getProtocolId());
+ }
+
//check if programId is sane
PersistenceService persistenceService =
getService(PersistenceService.class);
+ if (protocolId != null) {
+ TuttiProtocol protocol = persistenceService.getProtocol(protocolId);
+ if (protocol == null) {
+
+ // not found in this db
+
+ if (log.isWarnEnabled()) {
+ log.warn("Remove invalid protocolId: " + protocolId);
+ }
+
+ setProtocolId(null);
+ }
+ }
+
if (programId != null) {
Program program = persistenceService.getProgram(programId);
if (program == null) {
// not found in this db
- setProgramId(null);
- setCruiseId(null);
if (log.isWarnEnabled()) {
log.warn("Remove invalid programId: " + programId);
}
+
+ setProgramId(null);
+ setCruiseId(null);
+
} else {
if (log.isInfoEnabled()) {
@@ -259,11 +287,12 @@
if (campaign == null) {
// not found in this db
- setCruiseId(null);
if (log.isWarnEnabled()) {
log.warn("Remove invalid cruiseId: " + cruiseId);
}
+ setCruiseId(null);
+
} else {
if (log.isInfoEnabled()) {
@@ -280,13 +309,10 @@
// list when programId or campaingId change to save the configuration
addPropertyChangeListener(new PropertyChangeListener() {
- Set<String> acceptedProperties = Sets.newHashSet(
- PROPERTY_PROGRAM_ID, PROPERTY_CRUISE_ID);
-
@Override
public void propertyChange(PropertyChangeEvent evt) {
- if (acceptedProperties.contains(evt.getPropertyName())) {
+ if (ID_TO_SAVE_PROPERTIES.contains(evt.getPropertyName())) {
saveContextToConfig();
}
}
@@ -315,10 +341,11 @@
protected void saveContextToConfig() {
if (log.isInfoEnabled()) {
log.info("Save config (programId: " + programId + ", cruiseId: " +
- cruiseId + ")");
+ cruiseId + ", protocolId: " + protocolId + ")");
}
config.setProgramId(programId);
config.setCruiseId(cruiseId);
+ config.setProtocolId(protocolId);
config.save();
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2012-12-19 23:24:11 UTC (rev 92)
@@ -103,14 +103,14 @@
selectedItem: {model.getSubStrata()};
}
-#localiteLabel {
- text: "tutti.label.fishingOperation.localite";
- labelFor: {localiteComboBox};
+#locationLabel {
+ text: "tutti.label.fishingOperation.location";
+ labelFor: {locationComboBox};
}
-#localiteComboBox {
- property: "localite";
- selectedItem: {model.getLocalite()};
+#locationComboBox {
+ property: "location";
+ selectedItem: {model.getLocation()};
}
#gearLongitudeLabel {
@@ -218,104 +218,6 @@
enabled: {!model.isFishingOperationRectiligne()};
}
-#beaufortScaleLabel {
- text: "tutti.label.fishingOperation.beaufortScale";
- labelFor: {beaufortScaleComboBox};
-}
-
-#beaufortScaleComboBox {
- property: "beaufortScale";
- selectedItem: {model.getBeaufortScale()};
-}
-
-#windDirectionLabel {
- text: "tutti.label.fishingOperation.windDirection";
- labelFor: {windDirectionField};
-}
-
-#windDirectionField {
- property: "windDirection";
- model: {model.getWindDirection()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#seaStateLabel {
- text: "tutti.label.fishingOperation.seaState";
- labelFor: {seaStateComboBox};
-}
-
-#seaStateComboBox {
- property: "seaState";
- selectedItem: {model.getSeaState()};
-}
-
-#ouvertureHorizontaleLabel {
- text: "tutti.label.fishingOperation.ouvertureHorizontale";
- labelFor: {ouvertureHorizontaleField};
-}
-
-#ouvertureHorizontaleVerticaleLabel {
- text: "tutti.label.fishingOperation.ouvertureHorizontaleVerticale";
-}
-
-#ouvertureHorizontaleField {
- property: "ouvertureHorizontale";
- model: {model.getOuvertureHorizontale()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#ouvertureVerticaleLabel {
- text: "tutti.label.fishingOperation.ouvertureVerticale";
- labelFor: {ouvertureVerticaleField};
-}
-
-#ouvertureVerticaleField {
- property: "ouvertureVerticale";
- model: {model.getOuvertureVerticale()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#geometrieMesureeCheckBox {
- text: "tutti.label.fishingOperation.geometrieMesuree";
- selected: {model.isGeometrieMesuree()};
-}
-
-#longueurFunesLabel {
- text: "tutti.label.fishingOperation.longueurFunes";
- labelFor: {longueurFunesField};
-}
-
-#longueurFunesBrasLabel {
- text: "tutti.label.fishingOperation.longueurFunesBras";
-}
-
-#longueurFunesField {
- property: "longueurFunes";
- model: {model.getLongueurFunes()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#longueurBrasLabel {
- text: "tutti.label.fishingOperation.longueurBras";
- labelFor: {longueurBrasField};
-}
-
-#longueurBrasField {
- property: "longueurBras";
- model: {model.getLongueurBras()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#systemeFermetureCulCheckBox {
- text: "tutti.label.fishingOperation.systemeFermetureCul";
- selected: {model.isSystemeFermetureCul()};
-}
-
#dureeLabel {
text: "tutti.label.fishingOperation.duree";
labelFor: {dureeField};
@@ -341,150 +243,6 @@
text: {model.getComment()};
}
-#gearShootingStartDepthLabel {
- text: "tutti.label.fishingOperation.gearShootingStartDepth";
- labelFor: {gearShootingStartDepthField};
-}
-
-#gearShootingStartDepthField {
- property: "gearShootingStartDepth";
- model: {model.getGearShootingStartDepth()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndDepthLabel {
- text: "tutti.label.fishingOperation.gearShootingEndDepth";
- labelFor: {gearShootingEndDepthField};
-}
-
-#gearShootingEndDepthField {
- property: "gearShootingEndDepth";
- model: {model.getGearShootingEndDepth()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartSurfaceTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingStartSurfaceTemperature";
- labelFor: {gearShootingStartSurfaceTemperatureField};
-}
-
-#gearShootingStartSurfaceTemperatureField {
- property: "gearShootingStartSurfaceTemperature";
- model: {model.getGearShootingStartSurfaceTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndSurfaceTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingEndSurfaceTemperature";
- labelFor: {gearShootingEndSurfaceTemperatureField};
-}
-
-#gearShootingEndSurfaceTemperatureField {
- property: "gearShootingEndSurfaceTemperature";
- model: {model.getGearShootingEndSurfaceTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartBottomTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingStartBottomTemperature";
- labelFor: {gearShootingStartBottomTemperatureField};
-}
-
-#gearShootingStartBottomTemperatureField {
- property: "gearShootingStartBottomTemperature";
- model: {model.getGearShootingStartBottomTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndBottomTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingEndBottomTemperature";
- labelFor: {gearShootingEndBottomTemperatureField};
-}
-
-#gearShootingEndBottomTemperatureField {
- property: "gearShootingEndBottomTemperature";
- model: {model.getGearShootingEndBottomTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#averageBottomTemperatureLabel {
- text: "tutti.label.fishingOperation.averageBottomTemperature";
- labelFor: {averageBottomTemperatureField};
-}
-
-#averageBottomTemperatureField {
- property: "averageBottomTemperature";
- model: {model.getAverageBottomTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartSurfaceSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingStartSurfaceSalinity";
- labelFor: {gearShootingStartSurfaceSalinityField};
-}
-
-#gearShootingStartSurfaceSalinityField {
- property: "gearShootingStartSurfaceSalinity";
- model: {model.getGearShootingStartSurfaceSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndSurfaceSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingEndSurfaceSalinity";
- labelFor: {gearShootingEndSurfaceSalinityField};
-}
-
-#gearShootingEndSurfaceSalinityField {
- property: "gearShootingEndSurfaceSalinity";
- model: {model.getGearShootingEndSurfaceSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartBottomSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingStartBottomSalinity";
- labelFor: {gearShootingStartBottomSalinityField};
-}
-
-#gearShootingStartBottomSalinityField {
- property: "gearShootingStartBottomSalinity";
- model: {model.getGearShootingStartBottomSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndBottomSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingEndBottomSalinity";
- labelFor: {gearShootingEndBottomSalinityField};
-}
-
-#gearShootingEndBottomSalinityField {
- property: "gearShootingEndBottomSalinity";
- model: {model.getGearShootingEndBottomSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#averageBottomSalinityLabel {
- text: "tutti.label.fishingOperation.averageBottomSalinity";
- labelFor: {averageBottomSalinityField};
-}
-
-#averageBottomSalinityField {
- property: "averageBottomSalinity";
- model: {model.getAverageBottomSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
#noTraitPane {
text: "tutti.label.no.fishingOperation.selected";
horizontalAlignment: {JLabel.CENTER};
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2012-12-19 23:24:11 UTC (rev 92)
@@ -25,8 +25,6 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditFishingOperationUIModel, EditFishingOperationUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
- fr.ifremer.tutti.persistence.entities.referential.SeaState
fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.persistence.entities.referential.Person
@@ -69,10 +67,10 @@
]]></script>
<EditFishingOperationUIHandler id='handler'
- initializer='getContextValue(EditFishingOperationUIHandler.class)'/>
+ initializer='getContextValue(EditFishingOperationUIHandler.class)'/>
<EditFishingOperationUIModel id='model'
- initializer='getContextValue(EditFishingOperationUIModel.class)'/>
+ initializer='getContextValue(EditFishingOperationUIModel.class)'/>
<SwingValidatorMessageTableModel id='errorTableModel'/>
@@ -136,10 +134,10 @@
genericType='FishingOperationLocation'/>
</cell>
<cell>
- <JLabel id='localiteLabel'/>
+ <JLabel id='locationLabel'/>
</cell>
<cell weightx='0.3'>
- <BeanComboBox id='localiteComboBox' constructorParams='this'
+ <BeanComboBox id='locationComboBox' constructorParams='this'
genericType='FishingOperationLocation'/>
</cell>
</row>
@@ -308,8 +306,7 @@
<Table fill='both' id='gearShootingForm'>
- <!-- GearShootingStart Depth -->
- <row>
+ <!--row>
<cell>
<JLabel id='gearShootingStartDepthLabel'/>
</cell>
@@ -319,7 +316,6 @@
</cell>
</row>
- <!-- GearShootingEnd Depth -->
<row>
<cell>
<JLabel id='gearShootingEndDepthLabel'/>
@@ -330,7 +326,6 @@
</cell>
</row>
- <!-- Ouverture horizontale -->
<row>
<cell anchor='west'>
<JLabel id='ouvertureHorizontaleLabel'/>
@@ -341,7 +336,6 @@
</cell>
</row>
- <!-- Ouverture verticale -->
<row>
<cell anchor='west'>
<JLabel id='ouvertureVerticaleLabel'/>
@@ -352,7 +346,6 @@
</cell>
</row>
- <!-- Longueur funes -->
<row>
<cell anchor='west'>
<JLabel id='longueurFunesLabel'/>
@@ -362,7 +355,6 @@
</cell>
</row>
- <!-- Longueur bras -->
<row>
<cell anchor='west'>
<JLabel id='longueurBrasLabel'/>
@@ -372,7 +364,6 @@
</cell>
</row>
- <!-- Système de fermeture du cul / Geometrie mesuree -->
<row>
<cell columns='2'>
<JPanel layout='{new GridLayout(1,0)}'>
@@ -382,7 +373,7 @@
onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
</JPanel>
</cell>
- </row>
+ </row-->
</Table>
</tab>
@@ -390,40 +381,40 @@
title='tutti.label.tab.fishingOperation.environment'>
<EnvironmentTabUI id='environmentTabContent' constructorParams='this'/>
-<!-- <Table fill='both' id='environmentForm'>
+ <!-- <Table fill='both' id='environmentForm'>
- Beaufort scale
- <row>
- <cell anchor='west'>
- <JLabel id='beaufortScaleLabel'/>
- </cell>
- <cell weightx='1.0'>
- <BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
- genericType='BeaufortScale'/>
- </cell>
- </row>
+ Beaufort scale
+ <row>
+ <cell anchor='west'>
+ <JLabel id='beaufortScaleLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
+ genericType='BeaufortScale'/>
+ </cell>
+ </row>
- Wind direction
- <row>
- <cell anchor='west'>
- <JLabel id='windDirectionLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='windDirectionField' constructorParams='this'/>
- </cell>
- </row>
+ Wind direction
+ <row>
+ <cell anchor='west'>
+ <JLabel id='windDirectionLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='windDirectionField' constructorParams='this'/>
+ </cell>
+ </row>
- Sea state
- <row>
- <cell anchor='west'>
- <JLabel id='seaStateLabel'/>
- </cell>
- <cell fill='horizontal'>
- <BeanComboBox id='seaStateComboBox' constructorParams='this'
- genericType='SeaState'/>
- </cell>
- </row>
- </Table>-->
+ Sea state
+ <row>
+ <cell anchor='west'>
+ <JLabel id='seaStateLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <BeanComboBox id='seaStateComboBox' constructorParams='this'
+ genericType='SeaState'/>
+ </cell>
+ </row>
+ </Table>-->
</tab>
<tab id='traitHydrologyTabContent'
@@ -431,8 +422,7 @@
<Table fill='both' id='hydrologyForm'>
- <!-- GearShootingStartSurfaceTemperature -->
- <row>
+ <!--row>
<cell>
<JLabel id='gearShootingStartSurfaceTemperatureLabel'/>
</cell>
@@ -442,7 +432,6 @@
</cell>
</row>
- <!-- GearShootingEndSurfaceTemperature -->
<row>
<cell>
<JLabel id='gearShootingEndSurfaceTemperatureLabel'/>
@@ -453,7 +442,6 @@
</cell>
</row>
- <!-- GearShootingStartBottomTemperature -->
<row>
<cell>
<JLabel id='gearShootingStartBottomTemperatureLabel'/>
@@ -464,7 +452,6 @@
</cell>
</row>
- <!-- GearShootingEndBottomTemperature -->
<row>
<cell>
<JLabel id='gearShootingEndBottomTemperatureLabel'/>
@@ -475,7 +462,6 @@
</cell>
</row>
- <!-- AverageBottomTemperature -->
<row>
<cell>
<JLabel id='averageBottomTemperatureLabel'/>
@@ -486,7 +472,6 @@
</cell>
</row>
- <!-- GearShootingStartSurfaceSalinity -->
<row>
<cell>
<JLabel id='gearShootingStartSurfaceSalinityLabel'/>
@@ -497,7 +482,6 @@
</cell>
</row>
- <!-- GearShootingEndSurfaceSalinity -->
<row>
<cell>
<JLabel id='gearShootingEndSurfaceSalinityLabel'/>
@@ -508,7 +492,6 @@
</cell>
</row>
- <!-- GearShootingStartBottomSalinity -->
<row>
<cell>
<JLabel id='gearShootingStartBottomSalinityLabel'/>
@@ -519,7 +502,6 @@
</cell>
</row>
- <!-- GearShootingEndBottomSalinity -->
<row>
<cell>
<JLabel id='gearShootingEndBottomSalinityLabel'/>
@@ -530,7 +512,6 @@
</cell>
</row>
- <!-- AverageBottomSalinity -->
<row>
<cell>
<JLabel id='averageBottomSalinityLabel'/>
@@ -539,7 +520,7 @@
<NumberEditor id='averageBottomSalinityField'
constructorParams='this'/>
</cell>
- </row>
+ </row-->
</Table>
</tab>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -24,12 +24,17 @@
* #L%
*/
+import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.Zone;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.environment.EnvironmentTabUIModel;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -91,6 +96,24 @@
}
});
+ model.addPropertyChangeListener(EditFishingOperationUIModel.PROPERTY_STRATA, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ EditFishingOperationUIModel source = (EditFishingOperationUIModel) evt.getSource();
+ FishingOperationLocation newStrata = (FishingOperationLocation) evt.getNewValue();
+ onSelectedStrata(source, newStrata);
+ }
+ });
+
+ model.addPropertyChangeListener(EditFishingOperationUIModel.PROPERTY_SUB_STRATA, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ EditFishingOperationUIModel source = (EditFishingOperationUIModel) evt.getSource();
+ FishingOperationLocation newStrata = (FishingOperationLocation) evt.getNewValue();
+ onSelectedSubStrata(source, newStrata);
+ }
+ });
+
listModelIsModify(model);
ui.setContextValue(model);
@@ -110,23 +133,54 @@
persistenceService.getAllPerson(),
model.getSaisisseur());
-// initBeanComboBox(ui.getBeaufortScaleComboBox(),
-// persistenceService.getAllBeaufortScale(),
-// model.getBeaufortScale());
-//
-// initBeanComboBox(ui.getStrataComboBox(),
-// persistenceService.getAllStrata(),
-// model.getStrata());
-//
-// initBeanComboBox(ui.getSeaStateComboBox(),
-// persistenceService.getAllSeaState(),
-// model.getSeaState());
+ String programId = context.getProgramId();
+ Program program = persistenceService.getProgram(programId);
+ Zone zone = program.getZone();
+
+ FishingOperationLocation strata = model.getStrata();
+
+ String strataId = strata == null ? null : strata.getId();
+
+ FishingOperationLocation subStrata = model.getSubStrata();
+ String substrataId = subStrata == null ? null : subStrata.getId();
+
+ FishingOperationLocation location = model.getLocation();
+
+ List<FishingOperationLocation> stratas =
+ persistenceService.getAllFishingOperationStrata(zone.getId());
+
+ List<FishingOperationLocation> subStratas;
+
+ if (strataId == null) {
+ subStratas = Lists.newArrayList();
+ } else {
+
+ // load substratas
+ subStratas = persistenceService.getAllFishingOperationSubStrata(strataId);
+ }
+
+ List<FishingOperationLocation> locations;
+
+ if (substrataId == null) {
+ locations = Lists.newArrayList();
+ } else {
+
+ // load localites
+ locations = persistenceService.getAllFishingOperationLocation(substrataId);
+ }
+
+ initBeanComboBox(ui.getStrataComboBox(), stratas, strata);
+
+ initBeanComboBox(ui.getSubStrataComboBox(), subStratas, subStrata);
+
+ initBeanComboBox(ui.getLocationComboBox(), locations, location);
+
model.setEmpty(true);
listenValidatorValid(ui.getValidator(), getModel());
-
- EnvironmentTabUIModel environmentModel =
+
+ EnvironmentTabUIModel environmentModel =
ui.getEnvironmentTabContent().getModel();
environmentModel.addPropertyChangeListener(
EditFishingOperationUIModel.PROPERTY_ENVIRONMENT_PARAMETERS,
@@ -136,24 +190,24 @@
model.setModify(true);
}
}
- );
+ );
environmentModel.setEnvironmentParameters(getDefaultEnvironmentParams());
}
-
+
protected Map<Object, Object> getDefaultEnvironmentParams() {
Map<Object, Object> environmentParams = Maps.newHashMap();
environmentParams.put(
_(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_BEAUFORT_SCALE)),
null
- );
+ );
environmentParams.put(
- _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_WIND_DIRECTION)),
+ _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_WIND_DIRECTION)),
null
- );
+ );
environmentParams.put(
_(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_SEA_STATE)),
null
- );
+ );
return environmentParams;
}
@@ -189,7 +243,7 @@
// if new fishingOperation can already cancel his creation
model.setModify(!empty && model.isCreate());
-
+
ui.getEnvironmentTabContent().getModel().setEnvironmentParameters(getDefaultEnvironmentParams());
ui.getEnvironmentTabContent().getHandler().reset();
}
@@ -260,4 +314,64 @@
public void setGearShootingEndLongitude(String text) {
getModel().setGearShootingEndLongitude(Float.valueOf(text));
}
+
+ protected void onSelectedStrata(EditFishingOperationUIModel model,
+ FishingOperationLocation newStrata) {
+
+ // reset substrata value
+ model.setSubStrata(null);
+
+ // reset sub strata combo
+ ui.getSubStrataComboBox().setData(null);
+
+ if (newStrata == null) {
+
+ // reset strata, keep focus on it
+ ui.getStrataComboBox().grabFocus();
+
+ } else {
+
+ // try to load substrata
+
+ List<FishingOperationLocation> subStrata =
+ persistenceService.getAllFishingOperationSubStrata(newStrata.getId());
+
+ ui.getSubStrataComboBox().setData(subStrata);
+
+ if (CollectionUtils.isEmpty(subStrata)) {
+
+ // try to load localite
+
+ List<FishingOperationLocation> location =
+ persistenceService.getAllFishingOperationLocation(newStrata.getId());
+
+ ui.getLocationComboBox().setData(location);
+
+ ui.getLocationComboBox().grabFocus();
+ }
+ }
+ }
+
+ protected void onSelectedSubStrata(EditFishingOperationUIModel model,
+ FishingOperationLocation newSubStrata) {
+ // reset localite value
+ model.setLocation(null);
+
+ // reset localite combo
+ ui.getLocationComboBox().setData(null);
+
+ if (newSubStrata == null) {
+
+ // reset substrata, keep focus on it
+ ui.getSubStrataComboBox().grabFocus();
+ } else {
+
+ // try to load localite
+
+ List<FishingOperationLocation> location =
+ persistenceService.getAllFishingOperationLocation(newSubStrata.getId());
+
+ ui.getLocationComboBox().setData(location);
+ }
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -24,10 +24,10 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import fr.ird.type.SexagecimalPosition;
import org.nuiton.util.beans.Binder;
@@ -65,36 +65,14 @@
public static final String PROPERTY_GEAR_SHOOTING_START_DATE = "gearShootingStartDate";
- public static final String PROPERTY_GEAR_SHOOTING_START_DEPTH = "gearShootingStartDepth";
-
public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = "gearShootingEndLatitude";
public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = "gearShootingEndLongitude";
public static final String PROPERTY_GEAR_SHOOTING_END_DATE = "gearShootingEndDate";
- public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth";
-
-// public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale";
-//
-// public static final String PROPERTY_WIND_DIRECTION = "windDirection";
-//
-// public static final String PROPERTY_SEA_STATE = "seaState";
-
public static final String PROPERTY_ENVIRONMENT_PARAMETERS = "environmentParameters";
- public static final String PROPERTY_OUVERTURE_HORIZONTALE = "ouvertureHorizontale";
-
- public static final String PROPERTY_OUVERTURE_VERTICALE = "ouvertureVerticale";
-
- public static final String PROPERTY_GEOMETRIE_MESUREE = "geometrieMesuree";
-
- public static final String PROPERTY_LONGUEUR_FUNES = "longueurFunes";
-
- public static final String PROPERTY_LONGUEUR_BRAS = "longueurBras";
-
- public static final String PROPERTY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul";
-
public static final String PROPERTY_FISHING_OPERATION_RECTILIGNE = "fishingOperationRectiligne";
public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee";
@@ -103,32 +81,12 @@
public static final String PROPERTY_FISHING_OPERATION_VALID = "fishingOperationValid";
- public static final String PROPERTY_LOCALITE = "localite";
+ public static final String PROPERTY_LOCATION = "location";
public static final String PROPERTY_COMMENT = "comment";
public static final String PROPERTY_SAISISSEUR = "saisisseur";
- public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE = "gearShootingStartSurfaceTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE = "gearShootingEndSurfaceTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE = "gearShootingStartBottomTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE = "gearShootingEndBottomTemperature";
-
- public static final String PROPERTY_AVERAGE_BOTTOM_TEMPERATURE = "averageBottomTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY = "gearShootingStartSurfaceSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY = "gearShootingEndSurfaceSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY = "gearShootingStartBottomSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY = "gearShootingEndBottomSalinity";
-
- public static final String PROPERTY_AVERAGE_BOTTOM_SALINITY = "averageBottomSalinity";
-
protected boolean empty;
protected Cruise cruise;
@@ -161,8 +119,6 @@
protected Integer gearShootingStartTime;
- protected Float gearShootingStartDepth;
-
protected Float gearShootingEndLatitude;
protected Float gearShootingEndLongitude;
@@ -171,28 +127,8 @@
protected Integer gearShootingEndTime;
- protected Float gearShootingEndDepth;
-
-// protected BeaufortScale beaufortScale;
-//
-// protected Integer windDirection;
-//
-// protected SeaState seaState;
-
protected Map<Object, Object> environmentParameters;
- protected Float ouvertureHorizontale;
-
- protected Float ouvertureVerticale;
-
- protected boolean geometrieMesuree;
-
- protected Float longueurFunes;
-
- protected Float longueurBras;
-
- protected boolean systemeFermetureCul;
-
protected boolean fishingOperationRectiligne;
protected Float distanceChalutee;
@@ -201,32 +137,12 @@
protected Boolean fishingOperationValid;
- protected FishingOperationLocation localite;
+ protected FishingOperationLocation location;
protected String comment;
protected List<Person> saisisseur;
- protected Float gearShootingStartSurfaceTemperature;
-
- protected Float gearShootingEndSurfaceTemperature;
-
- protected Float gearShootingStartBottomTemperature;
-
- protected Float gearShootingEndBottomTemperature;
-
- protected Float averageBottomTemperature;
-
- protected Float gearShootingStartSurfaceSalinity;
-
- protected Float gearShootingEndSurfaceSalinity;
-
- protected Float gearShootingStartBottomSalinity;
-
- protected Float gearShootingEndBottomSalinity;
-
- protected Float averageBottomSalinity;
-
protected static Binder<EditFishingOperationUIModel, FishingOperation> toBeanBinder =
BinderFactory.newBinder(EditFishingOperationUIModel.class,
FishingOperation.class);
@@ -336,16 +252,6 @@
firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DATE, oldValue, gearShootingStartDate);
}
- public Float getGearShootingStartDepth() {
- return gearShootingStartDepth;
- }
-
- public void setGearShootingStartDepth(Float gearShootingStartDepth) {
- Object oldValue = getGearShootingStartDepth();
- this.gearShootingStartDepth = gearShootingStartDepth;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DEPTH, oldValue, gearShootingStartDepth);
- }
-
public Float getGearShootingEndLatitude() {
return gearShootingEndLatitude;
}
@@ -376,116 +282,16 @@
firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, gearShootingEndDate);
}
- public Float getGearShootingEndDepth() {
- return gearShootingEndDepth;
- }
-
- public void setGearShootingEndDepth(Float gearShootingEndDepth) {
- Object oldValue = getGearShootingEndDepth();
- this.gearShootingEndDepth = gearShootingEndDepth;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth);
- }
-
-// public BeaufortScale getBeaufortScale() {
-// return beaufortScale;
-// }
-//
-// public void setBeaufortScale(BeaufortScale beaufortScale) {
-// Object oldValue = getBeaufortScale();
-// this.beaufortScale = beaufortScale;
-// firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale);
-// }
-//
-// public Integer getWindDirection() {
-// return windDirection;
-// }
-//
-// public void setWindDirection(Integer windDirection) {
-// Object oldValue = getWindDirection();
-// this.windDirection = windDirection;
-// firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection);
-// }
-//
-// public SeaState getSeaState() {
-// return seaState;
-// }
-//
-// public void setSeaState(SeaState seaState) {
-// Object oldValue = getSeaState();
-// this.seaState = seaState;
-// firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState);
-// }
-
public Map<Object, Object> getEnvironmentParameters() {
return environmentParameters;
}
-
+
public void setEnvironmentParameters(Map<Object, Object> environmentParameters) {
Object oldValue = getEnvironmentParameters();
this.environmentParameters = environmentParameters;
firePropertyChange(PROPERTY_ENVIRONMENT_PARAMETERS, oldValue, environmentParameters);
}
- public Float getOuvertureHorizontale() {
- return ouvertureHorizontale;
- }
-
- public void setOuvertureHorizontale(Float ouvertureHorizontale) {
- Object oldValue = getOuvertureHorizontale();
- this.ouvertureHorizontale = ouvertureHorizontale;
- firePropertyChange(PROPERTY_OUVERTURE_HORIZONTALE, oldValue, ouvertureHorizontale);
- }
-
- public Float getOuvertureVerticale() {
- return ouvertureVerticale;
- }
-
- public void setOuvertureVerticale(Float ouvertureVerticale) {
- Object oldValue = getOuvertureVerticale();
- this.ouvertureVerticale = ouvertureVerticale;
- firePropertyChange(PROPERTY_OUVERTURE_VERTICALE, oldValue, ouvertureVerticale);
- }
-
- public boolean isGeometrieMesuree() {
- return geometrieMesuree;
- }
-
- public void setGeometrieMesuree(boolean geometrieMesuree) {
- Object oldValue = isGeometrieMesuree();
- this.geometrieMesuree = geometrieMesuree;
- firePropertyChange(PROPERTY_GEOMETRIE_MESUREE, oldValue, geometrieMesuree);
- }
-
- public Float getLongueurFunes() {
- return longueurFunes;
- }
-
- public void setLongueurFunes(Float longueurFunes) {
- Object oldValue = getLongueurFunes();
- this.longueurFunes = longueurFunes;
- firePropertyChange(PROPERTY_LONGUEUR_FUNES, oldValue, longueurFunes);
- }
-
- public Float getLongueurBras() {
- return longueurBras;
- }
-
- public void setLongueurBras(Float longueurBras) {
- Object oldValue = getLongueurBras();
- this.longueurBras = longueurBras;
- firePropertyChange(PROPERTY_LONGUEUR_BRAS, oldValue, longueurBras);
- }
-
- public boolean isSystemeFermetureCul() {
- return systemeFermetureCul;
- }
-
- public void setSystemeFermetureCul(boolean systemeFermetureCul) {
- Object oldValue = isSystemeFermetureCul();
- this.systemeFermetureCul = systemeFermetureCul;
- firePropertyChange(PROPERTY_SYSTEME_FERMETURE_CUL, oldValue, systemeFermetureCul);
- }
-
public boolean isFishingOperationRectiligne() {
return fishingOperationRectiligne;
}
@@ -526,14 +332,14 @@
firePropertyChange(PROPERTY_FISHING_OPERATION_VALID, oldValue, fishingOperationValid);
}
- public FishingOperationLocation getLocalite() {
- return localite;
+ public FishingOperationLocation getLocation() {
+ return location;
}
- public void setLocalite(FishingOperationLocation localite) {
- Object oldValue = getLocalite();
- this.localite = localite;
- firePropertyChange(PROPERTY_LOCALITE, oldValue, localite);
+ public void setLocation(FishingOperationLocation location) {
+ Object oldValue = getLocation();
+ this.location = location;
+ firePropertyChange(PROPERTY_LOCATION, oldValue, location);
}
public String getComment() {
@@ -555,103 +361,4 @@
firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur);
}
- public Float getGearShootingStartSurfaceTemperature() {
- return gearShootingStartSurfaceTemperature;
- }
-
- public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) {
- Object oldValue = getGearShootingStartSurfaceTemperature();
- this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE, oldValue, gearShootingStartSurfaceTemperature);
- }
-
- public Float getGearShootingEndSurfaceTemperature() {
- return gearShootingEndSurfaceTemperature;
- }
-
- public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) {
- Object oldValue = getGearShootingEndSurfaceTemperature();
- this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE, oldValue, gearShootingEndSurfaceTemperature);
- }
-
- public Float getGearShootingStartBottomTemperature() {
- return gearShootingStartBottomTemperature;
- }
-
- public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) {
- Object oldValue = getGearShootingStartBottomTemperature();
- this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE, oldValue, gearShootingStartBottomTemperature);
- }
-
- public Float getGearShootingEndBottomTemperature() {
- return gearShootingEndBottomTemperature;
- }
-
- public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) {
- Object oldValue = getGearShootingEndBottomTemperature();
- this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE, oldValue, gearShootingEndBottomTemperature);
- }
-
- public Float getAverageBottomTemperature() {
- return averageBottomTemperature;
- }
-
- public void setAverageBottomTemperature(Float averageBottomTemperature) {
- Object oldValue = getAverageBottomTemperature();
- this.averageBottomTemperature = averageBottomTemperature;
- firePropertyChange(PROPERTY_AVERAGE_BOTTOM_TEMPERATURE, oldValue, averageBottomTemperature);
- }
-
- public Float getGearShootingStartSurfaceSalinity() {
- return gearShootingStartSurfaceSalinity;
- }
-
- public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) {
- Object oldValue = getGearShootingStartSurfaceSalinity();
- this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY, oldValue, gearShootingStartSurfaceSalinity);
- }
-
- public Float getGearShootingEndSurfaceSalinity() {
- return gearShootingEndSurfaceSalinity;
- }
-
- public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) {
- Object oldValue = getGearShootingEndSurfaceSalinity();
- this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY, oldValue, gearShootingEndSurfaceSalinity);
- }
-
- public Float getGearShootingStartBottomSalinity() {
- return gearShootingStartBottomSalinity;
- }
-
- public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) {
- Object oldValue = getGearShootingStartBottomSalinity();
- this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY, oldValue, gearShootingStartBottomSalinity);
- }
-
- public Float getGearShootingEndBottomSalinity() {
- return gearShootingEndBottomSalinity;
- }
-
- public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) {
- Object oldValue = getGearShootingEndBottomSalinity();
- this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY, oldValue, gearShootingEndBottomSalinity);
- }
-
- public Float getAverageBottomSalinity() {
- return averageBottomSalinity;
- }
-
- public void setAverageBottomSalinity(Float averageBottomSalinity) {
- Object oldValue = getAverageBottomSalinity();
- this.averageBottomSalinity = averageBottomSalinity;
- firePropertyChange(PROPERTY_AVERAGE_BOTTOM_SALINITY, oldValue, averageBottomSalinity);
- }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2012-12-19 23:24:11 UTC (rev 92)
@@ -38,6 +38,10 @@
selectedItem: {model.getSelectedFishingOperation()};
}
+#catchesTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
#speciesTab {
enabled: {model.getSelectedFishingOperation() != null};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-19 23:24:11 UTC (rev 92)
@@ -33,6 +33,7 @@
fr.ifremer.tutti.ui.swing.content.operation.macrowaste.MacroWasteBatchUI
fr.ifremer.tutti.ui.swing.content.operation.plankton.PlanktonBatchUI
fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI
jaxx.runtime.swing.editor.bean.BeanComboBox
@@ -76,6 +77,9 @@
<tab id='fishingOperationTab' title='tutti.label.tab.fishingOperation'>
<EditFishingOperationUI id='fishingOperationTabContent' constructorParams='this'/>
</tab>
+ <tab id='catchesTab' title='tutti.label.tab.catches'>
+ <EditCatchesUI id='catchesTabContent' constructorParams='this'/>
+ </tab>
<tab id='speciesTab' title='tutti.label.tab.species'>
<SpeciesBatchUI id='speciesTabContent' constructorParams='this'/>
</tab>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -34,6 +34,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Date;
@@ -169,8 +171,14 @@
// back to general tab of fishingOperation tabs
ui.getFishingOperationTabContent().getFishingOperationTabPane().setSelectedIndex(0);
+ ui.getTabPane().addChangeListener(new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ }
+ });
// propagate fishingOperation to his tabs
ui.getFishingOperationTabContent().selectFishingOperation(fishingOperation);
+ ui.getCatchesTabContent().selectFishingOperation(fishingOperation);
ui.getSpeciesTabContent().selectFishingOperation(fishingOperation);
ui.getBenthosTabContent().selectFishingOperation(fishingOperation);
ui.getPlanktonTabContent().selectFishingOperation(fishingOperation);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -41,11 +41,6 @@
private static final long serialVersionUID = 1L;
- public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
- BenthosBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
- n_("tutti.table.benthos.batch.header.toConfirm"),
- n_("tutti.table.benthos.batch.header.toConfirm"));
-
public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_SPECIES,
n_("tutti.table.benthos.batch.header.speciesByCode"),
@@ -68,8 +63,8 @@
public static final ColumnIdentifier<BenthosBatchRowModel> SAMPLING_RATIO = ColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_SAMPLING_RATIO,
- n_("tutti.table.benthos.batch.header.elevationRate"),
- n_("tutti.table.benthos.batch.header.elevationRate"));
+ n_("tutti.table.benthos.batch.header.samplingRatio"),
+ n_("tutti.table.benthos.batch.header.samplingRatio"));
public static final ColumnIdentifier<BenthosBatchRowModel> COMMENT = ColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_COMMENT,
@@ -81,6 +76,10 @@
n_("tutti.table.benthos.batch.header.file"),
n_("tutti.table.benthos.batch.header.file"));
+ public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ n_("tutti.table.benthos.batch.header.toConfirm"),
+ n_("tutti.table.benthos.batch.header.toConfirm"));
public BenthosBatchTableModel(TableColumnModel columnModel) {
super(columnModel);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css 2012-12-19 23:24:11 UTC (rev 92)
@@ -30,8 +30,8 @@
}
#totalWeightLabel {
- text: "tutti.label.benthos.totalWeight";
- labelFor: {totalWeightField};
+ text: "tutti.label.benthos.totalWeight";
+ labelFor: {totalWeightField};
}
#totalWeightField {
@@ -42,8 +42,8 @@
}
#sampleTotalWeightLabel {
- text: "tutti.label.benthos.sampleTotalWeight";
- labelFor: {totalWeightField};
+ text: "tutti.label.benthos.sampleTotalWeight";
+ labelFor: {sampleTotalWeightField};
}
#sampleTotalWeightField {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -117,14 +117,6 @@
DefaultTableColumnModelExt columnModel =
new DefaultTableColumnModelExt();
- {
- // Species to confirm column
-
- addBooleanColumnToModel(columnModel,
- BenthosBatchTableModel.SPECIES_TO_CONFIRM,
- getTable());
- }
-
List<Species> allSpecies = persistenceService.getAllSpecies();
{
@@ -186,6 +178,13 @@
n_("tutti.tooltip.attachment.none")),
BenthosBatchTableModel.ATTACHMENTS);
}
+
+ { // Species to confirm column
+
+ addBooleanColumnToModel(columnModel,
+ BenthosBatchTableModel.SPECIES_TO_CONFIRM,
+ getTable());
+ }
return columnModel;
}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2012-12-19 23:24:11 UTC (rev 92)
@@ -0,0 +1,113 @@
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#speciesTotalWeightLabel {
+ text: "tutti.label.species.speciesTotalWeight";
+ labelFor: {speciesTotalWeightField};
+}
+
+#speciesTotalWeightField {
+ property: "speciesTotalWeight";
+ model: {model.getSpeciesTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#speciesTotalVracWeightLabel {
+ text: "tutti.label.species.speciesTotalVracWeight";
+ labelFor: {speciesTotalVracWeightField};
+}
+
+#speciesTotalVracWeightField {
+ property: "speciesTotalVracWeight";
+ model: {model.getSpeciesTotalVracWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#speciesSampleVracWeightLabel {
+ text: "tutti.label.species.speciesSampleVracWeight";
+ labelFor: {speciesSampleVracWeightField};
+}
+
+#speciesSampleVracWeightField {
+ property: "speciesSampleVracWeight";
+ model: {model.getSpeciesSampleVracWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#speciesTotalHorsVracWeightLabel {
+ text: "tutti.label.species.speciesTotalHorsVracWeight";
+ labelFor: {speciesTotalHorsVracWeightField};
+}
+
+#speciesTotalHorsVracWeightField {
+ text: {getStringValue(model.getSpeciesTotalHorsVracWeight())};
+ editable: false;
+}
+
+#benthosTotalWeightLabel {
+ text: "tutti.label.benthos.benthosTotalWeight";
+ labelFor: {benthosTotalWeightField};
+}
+
+#benthosTotalWeightField {
+ property: "benthosTotalWeight";
+ model: {model.getBenthosTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#benthosSampleTotalWeightLabel {
+ text: "tutti.label.benthos.benthosSampleTotalWeight";
+ labelFor: {benthosSampleTotalWeightField};
+}
+
+#benthosSampleTotalWeightField {
+ property: "benthosSampleTotalWeight";
+ model: {model.getBenthosSampleTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#planktonTotalWeightLabel {
+ text: "tutti.label.plankton.planktontotalWeight";
+ labelFor: {planktonTotalWeightField};
+}
+
+#planktonTotalWeightField {
+ property: "planktonTotalWeight";
+ model: {model.getPlanktonTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#planktonSampleTotalWeightLabel {
+ text: "tutti.label.plankton.planktonSampleTotalWeight";
+ labelFor: {planktonSampleTotalWeightField};
+}
+
+#planktonSampleTotalWeightField {
+ property: "planktonSampleTotalWeight";
+ model: {model.getPlanktonSampleTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#macroWasteTotalWeightLabel {
+ text: "tutti.label.macroWaste.macroWasteTotalWeight";
+ labelFor: {macroWasteTotalWeightField};
+}
+
+#macroWasteTotalWeightField {
+ property: "macroWasteTotalWeight";
+ model: {model.getMacroWasteTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2012-12-19 23:24:11 UTC (rev 92)
@@ -0,0 +1,98 @@
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditCatchesUIModel, EditCatchesUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesFrequencyUI
+ fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
+ fr.ifremer.tutti.ui.swing.util.editor.AttachmentEditorUI
+
+ org.jdesktop.swingx.JXTable
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.ListSelectionModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+ </import>
+
+ <script><![CDATA[
+
+public EditCatchesUI(FishingOperationsUI parentUI) {
+ EditCatchesUIHandler handler = new EditCatchesUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <EditCatchesUIHandler id='handler'
+ initializer='getContextValue(EditCatchesUIHandler.class)'/>
+
+ <EditCatchesUIModel id='model'
+ initializer='getContextValue(EditCatchesUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='speciesTotalWeight' component='speciesTotalWeightField'/>
+ <field name='speciesTotalVracWeight' component='speciesTotalVracWeightField'/>
+ <field name='speciesSampleVracWeight' component='speciesSampleVracWeightField'/>
+ <field name='speciesTotalHorsVracWeight' component='speciesTotalHorsVracWeightField'/>
+ </BeanValidator>
+
+ <JPanel constraints='BorderLayout.NORTH' layout='{new BorderLayout()}'>
+ <JLabel id='fishingOperationReminderLabel'
+ constraints='BorderLayout.NORTH'/>
+ <JSeparator constraints='BorderLayout.CENTER'/>
+
+ <Table id='form' fill='both' constraints='BorderLayout.SOUTH'>
+
+ <!-- Poids total / Poids total vrac -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='speciesTotalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='speciesTotalWeightField' constructorParams='this'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='speciesTotalVracWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='speciesTotalVracWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids échantillonné vrac / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='speciesSampleVracWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='speciesSampleVracWeightField' constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='speciesTotalHorsVracWeightLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='speciesTotalHorsVracWeightField'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+
+</JPanel>
\ No newline at end of file
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -0,0 +1,175 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches;
+
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.decorator.Decorator;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class EditCatchesUIHandler extends AbstractTuttiUIHandler<EditCatchesUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EditCatchesUIHandler.class);
+
+ private final EditCatchesUI ui;
+
+ private final FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ /**
+ * To monitor changes on the fishing operation.
+ *
+ * @since 0.2
+ */
+ private final TuttiBeanMonitor<EditCatchesUIModel> fishingOperationMonitor;
+
+ public EditCatchesUIHandler(FishingOperationsUI parentUi, EditCatchesUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ this.fishingOperationMonitor = new TuttiBeanMonitor<EditCatchesUIModel>(
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_PLANKTON_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_MACRO_WASTE_TOTAL_WEIGHT
+ );
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ EditCatchesUIModel model = new EditCatchesUIModel();
+
+ listModelIsModify(model);
+
+ ui.setContextValue(model);
+
+ fishingOperationMonitor.setBean(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected EditCatchesUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ if (fishingOperationMonitor.wasModified()) {
+
+ // previous fishingOperation was modified, let's save it
+ EditCatchesUIModel beanToSave = fishingOperationMonitor.getBean();
+
+ FishingOperation fishingOperation = beanToSave.toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("FishingOperation " + fishingOperation.getId() +
+ " was modified, will save it.");
+ }
+
+ persistenceService.saveFishingOperation(fishingOperation);
+ }
+
+ boolean empty = bean == null;
+
+ EditCatchesUIModel model = getModel();
+
+ String fishingoperationText;
+
+ if (empty) {
+ bean = new FishingOperation();
+ model.setFishingOperation(null);
+ fishingoperationText = "";
+ } else {
+
+ Decorator<FishingOperation> decorator =
+ getDecorator(FishingOperation.class, null);
+
+ fishingoperationText =
+ _("tutti.label.traitReminder", decorator.toString(bean));
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species batch for fishingOperation: " +
+ bean.getId() + " - " + fishingoperationText);
+ }
+
+
+ model.setFishingOperation(bean);
+ }
+
+ model.fromBean(bean);
+
+ fishingOperationMonitor.clearModified();
+
+ ui.getFishingOperationReminderLabel().setText(fishingoperationText);
+ }
+
+ public void cancel() {
+
+ String id = getModel().getId();
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition for fishingOperation: " + id);
+ }
+ boolean newBean = StringUtils.isBlank(id);
+
+ if (newBean) {
+
+ // cancel to create a new fishingOperation
+ parentUi.getHandler().selectFishingOperation(null);
+
+ } else {
+
+ // reselect in ui the fishingOperation
+ FishingOperation selectedFishingOperation = parentUi.getModel().getSelectedFishingOperation();
+ parentUi.getHandler().selectFishingOperation(selectedFishingOperation);
+ }
+ }
+
+ public void save() {
+
+ // get fishingOperation to save
+ FishingOperation toSave = getModel().toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("Save edition for fishingOperation: " + toSave.getId());
+ }
+
+ // persist current fishingOperation
+ parentUi.getHandler().saveFishingOperation(toSave);
+
+ getModel().setModify(false);
+ }
+
+ public void importPupitri() {
+ //TODO
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -0,0 +1,167 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches;
+
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class EditCatchesUIModel extends AbstractTuttiBeanUIModel<FishingOperation, EditCatchesUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_SPECIES_TOTAL_WEIGHT = "speciesTotalWeight";
+
+ public static final String PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT = "speciesTotalVracWeight";
+
+ public static final String PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT = "speciesSampleVracWeight";
+
+ public static final String PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT = "speciesTotalHorsVracWeight";
+
+ public static final String PROPERTY_BENTHOS_TOTAL_WEIGHT = "benthosTotalWeight";
+
+ public static final String PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT = "benthosSampleTotalWeight";
+
+ public static final String PROPERTY_PLANKTON_TOTAL_WEIGHT = "planktonTotalWeight";
+
+ public static final String PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT = "planktonSampleTotalWeight";
+
+ public static final String PROPERTY_MACRO_WASTE_TOTAL_WEIGHT = "macroWasteTotalWeight";
+
+ protected static Binder<EditCatchesUIModel, FishingOperation> toBeanBinder =
+ BinderFactory.newBinder(EditCatchesUIModel.class,
+ FishingOperation.class);
+
+ protected static Binder<FishingOperation, EditCatchesUIModel> fromBeanBinder =
+ BinderFactory.newBinder(FishingOperation.class, EditCatchesUIModel.class);
+
+ protected Float speciesTotalWeight;
+
+ protected Float speciesTotalVracWeight;
+
+ protected Float speciesSampleVracWeight;
+
+ protected Float speciesTotalHorsVracWeight;
+
+ protected Float benthosTotalWeight;
+
+ protected Float benthosSampleTotalWeight;
+
+ protected Float planktonTotalWeight;
+
+ protected Float planktonSampleTotalWeight;
+
+ protected Float macroWasteTotalWeight;
+
+ protected FishingOperation fishingOperation;
+
+ public EditCatchesUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public FishingOperation getFishingOperation() {
+ return fishingOperation;
+ }
+
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ this.fishingOperation = fishingOperation;
+ }
+
+ public Float getSpeciesTotalWeight() {
+ return speciesTotalWeight;
+ }
+
+ public void setSpeciesTotalWeight(Float speciesTotalWeight) {
+ Object oldValue = getSpeciesTotalWeight();
+ this.speciesTotalWeight = speciesTotalWeight;
+ firePropertyChange(PROPERTY_SPECIES_TOTAL_WEIGHT, oldValue, speciesTotalWeight);
+ }
+
+ public Float getSpeciesTotalVracWeight() {
+ return speciesTotalVracWeight;
+ }
+
+ public void setSpeciesTotalVracWeight(Float speciesTotalVracWeight) {
+ Object oldValue = getSpeciesTotalVracWeight();
+ this.speciesTotalVracWeight = speciesTotalVracWeight;
+ firePropertyChange(PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT, oldValue, speciesTotalVracWeight);
+ }
+
+ public Float getSpeciesSampleVracWeight() {
+ return speciesSampleVracWeight;
+ }
+
+ public void setSpeciesSampleVracWeight(Float speciesSampleVracWeight) {
+ Object oldValue = getSpeciesSampleVracWeight();
+ this.speciesSampleVracWeight = speciesSampleVracWeight;
+ firePropertyChange(PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT, oldValue, speciesSampleVracWeight);
+ }
+
+ public Float getSpeciesTotalHorsVracWeight() {
+ return speciesTotalHorsVracWeight;
+ }
+
+ public void setSpeciesTotalHorsVracWeight(Float speciesTotalHorsVracWeight) {
+ Object oldValue = getSpeciesTotalHorsVracWeight();
+ this.speciesTotalHorsVracWeight = speciesTotalHorsVracWeight;
+ firePropertyChange(PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT, oldValue, speciesTotalHorsVracWeight);
+ }
+
+ public Float getBenthosTotalWeight() {
+ return benthosTotalWeight;
+ }
+
+ public void setBenthosTotalWeight(Float benthosTotalWeight) {
+ Object oldValue = getBenthosTotalWeight();
+ this.benthosTotalWeight = benthosTotalWeight;
+ firePropertyChange(PROPERTY_BENTHOS_TOTAL_WEIGHT, oldValue, benthosTotalWeight);
+ }
+
+ public Float getBenthosSampleTotalWeight() {
+ return benthosSampleTotalWeight;
+ }
+
+ public void setBenthosSampleTotalWeight(Float benthosSampleTotalWeight) {
+ Object oldValue = getBenthosSampleTotalWeight();
+ this.benthosSampleTotalWeight = benthosSampleTotalWeight;
+ firePropertyChange(PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT, oldValue, benthosSampleTotalWeight);
+ }
+
+ public Float getPlanktonTotalWeight() {
+ return planktonTotalWeight;
+ }
+
+ public void setPlanktonTotalWeight(Float planktonTotalWeight) {
+ Object oldValue = getPlanktonTotalWeight();
+ this.planktonTotalWeight = planktonTotalWeight;
+ firePropertyChange(PROPERTY_PLANKTON_TOTAL_WEIGHT, oldValue, planktonTotalWeight);
+ }
+
+ public Float getPlanktonSampleTotalWeight() {
+ return planktonSampleTotalWeight;
+ }
+
+ public void setPlanktonSampleTotalWeight(Float planktonSampleTotalWeight) {
+ Object oldValue = getPlanktonSampleTotalWeight();
+ this.planktonSampleTotalWeight = planktonSampleTotalWeight;
+ firePropertyChange(PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT, oldValue, planktonSampleTotalWeight);
+ }
+
+ public Float getMacroWasteTotalWeight() {
+ return macroWasteTotalWeight;
+ }
+
+ public void setMacroWasteTotalWeight(Float macroWasteTotalWeight) {
+ Object oldValue = getMacroWasteTotalWeight();
+ this.macroWasteTotalWeight = macroWasteTotalWeight;
+ firePropertyChange(PROPERTY_MACRO_WASTE_TOTAL_WEIGHT, oldValue, macroWasteTotalWeight);
+ }
+
+ @Override
+ protected FishingOperation newEntity() {
+ return fishingOperation;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchRowModel.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchRowModel.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -26,7 +26,7 @@
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
-import fr.ifremer.tutti.persistence.entities.referential.MacroWasteCategory;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -56,7 +56,7 @@
*
* @since 0.2
*/
- protected MacroWasteCategory macroWasteCategory;
+ protected CaracteristicQualitativeValue macroWasteCategory;
/**
* Observed weight.
@@ -96,11 +96,11 @@
fromBean(aBatch);
}
- public MacroWasteCategory getMacroWasteCategory() {
+ public CaracteristicQualitativeValue getMacroWasteCategory() {
return macroWasteCategory;
}
- public void setMacroWasteCategory(MacroWasteCategory macroWasteCategory) {
+ public void setMacroWasteCategory(CaracteristicQualitativeValue macroWasteCategory) {
Object oldValue = getMacroWasteCategory();
this.macroWasteCategory = macroWasteCategory;
firePropertyChange(PROPERTY_MACRO_WASTE_CATEGORY, oldValue, macroWasteCategory);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css 2012-12-19 23:24:11 UTC (rev 92)
@@ -30,8 +30,8 @@
}
#totalWeightLabel {
- text: "tutti.label.macroWaste.totalWeight";
- labelFor: {totalWeightField};
+ text: "tutti.label.macroWaste.totalWeight";
+ labelFor: {totalWeightField};
}
#totalWeightField {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -29,7 +29,7 @@
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
-import fr.ifremer.tutti.persistence.entities.referential.MacroWasteCategory;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
@@ -107,12 +107,12 @@
{
// MacroWaste Category column
- Decorator<MacroWasteCategory> decorator = getDecorator(
- MacroWasteCategory.class, null);
+ Decorator<CaracteristicQualitativeValue> decorator = getDecorator(
+ CaracteristicQualitativeValue.class, null);
addComboDataColumnToModel(columnModel,
MacroWasteBatchTableModel.MACRO_WASTE_CATEGORY,
- decorator, persistenceService.getAllMacroWasteCategory());
+ decorator, persistenceService.getMacroWasteCategoryCaracteristic().getQualitativeValue());
}
{ // Weight column
@@ -292,7 +292,7 @@
rows = null;
bean = new FishingOperation();
model.setFishingOperation(null);
- fishingoperationText="";
+ fishingoperationText = "";
} else {
Decorator<FishingOperation> decorator =
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css 2012-12-19 23:24:11 UTC (rev 92)
@@ -30,8 +30,8 @@
}
#totalWeightLabel {
- text: "tutti.label.plankton.totalWeight";
- labelFor: {totalWeightField};
+ text: "tutti.label.plankton.totalWeight";
+ labelFor: {totalWeightField};
}
#totalWeightField {
@@ -42,8 +42,8 @@
}
#sampleTotalWeightLabel {
- text: "tutti.label.plankton.sampleTotalWeight";
- labelFor: {totalWeightField};
+ text: "tutti.label.plankton.sampleTotalWeight";
+ labelFor: {sampleTotalWeightField};
}
#sampleTotalWeightField {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -28,10 +28,8 @@
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.referential.Sex;
-import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import org.apache.commons.collections.CollectionUtils;
import org.nuiton.util.beans.Binder;
@@ -56,11 +54,11 @@
public static final String PROPERTY_SORTED_UNSORTED_CATEGORY = "sortedUnsortedCategory";
- public static final String PROPERTY_WEIGHT_CATEGORY = "weightCategory";
+ public static final String PROPERTY_SIZE_CATEGORY = "sizeCategory";
- public static final String PROPERTY_SEX = "sex";
+ public static final String PROPERTY_SEX_CATEGORY = "sexCategory";
- public static final String PROPERTY_MATURITY = "maturity";
+ public static final String PROPERTY_MATURITY_CATEGORY = "maturityCategory";
public static final String PROPERTY_AGE = "age";
@@ -77,7 +75,7 @@
public static final String PROPERTY_COMPUTED_NUMBER = "computedNumber";
public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight";
-
+
public static final String PROPERTY_ATTACHMENTS = "attachments";
/**
@@ -99,28 +97,28 @@
*
* @since 0.2
*/
- protected SortedUnsortedCategory sortedUnsortedCategory;
+ protected CaracteristicQualitativeValue sortedUnsortedCategory;
/**
* Weight category (can be null).
*
* @since 0.2
*/
- protected WeightCategory weightCategory;
+ protected CaracteristicQualitativeValue sizeCategory;
/**
* Sex (can be null).
*
* @since 0.2
*/
- protected Sex sex;
+ protected CaracteristicQualitativeValue sexCategory;
/**
* Maturity (can be null).
*
* @since 0.2
*/
- protected Float maturity;
+ protected CaracteristicQualitativeValue maturityCategory;
/**
* Age (can be null).
@@ -170,10 +168,10 @@
* @since 0.2
*/
protected String comment;
-
+
/**
* Attachments
- *
+ *
* @since 0.2
*/
protected List<Attachment> attachments;
@@ -254,44 +252,44 @@
firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
}
- public SortedUnsortedCategory getSortedUnsortedCategory() {
+ public CaracteristicQualitativeValue getSortedUnsortedCategory() {
return sortedUnsortedCategory;
}
- public void setSortedUnsortedCategory(SortedUnsortedCategory sortedUnsortedCategory) {
+ public void setSortedUnsortedCategory(CaracteristicQualitativeValue sortedUnsortedCategory) {
Object oldValue = getSortedUnsortedCategory();
this.sortedUnsortedCategory = sortedUnsortedCategory;
firePropertyChange(PROPERTY_SORTED_UNSORTED_CATEGORY, oldValue, sortedUnsortedCategory);
}
- public WeightCategory getWeightCategory() {
- return weightCategory;
+ public CaracteristicQualitativeValue getSizeCategory() {
+ return sizeCategory;
}
- public void setWeightCategory(WeightCategory weightCategory) {
- Object oldValue = getWeightCategory();
- this.weightCategory = weightCategory;
- firePropertyChange(PROPERTY_WEIGHT_CATEGORY, oldValue, weightCategory);
+ public void setSizeCategory(CaracteristicQualitativeValue sizeCategory) {
+ Object oldValue = getSizeCategory();
+ this.sizeCategory = sizeCategory;
+ firePropertyChange(PROPERTY_SIZE_CATEGORY, oldValue, sizeCategory);
}
- public Sex getSex() {
- return sex;
+ public CaracteristicQualitativeValue getSexCategory() {
+ return sexCategory;
}
- public void setSex(Sex sex) {
- Object oldValue = getSex();
- this.sex = sex;
- firePropertyChange(PROPERTY_SEX, oldValue, sex);
+ public void setSexCategory(CaracteristicQualitativeValue sexCategory) {
+ Object oldValue = getSexCategory();
+ this.sexCategory = sexCategory;
+ firePropertyChange(PROPERTY_SEX_CATEGORY, oldValue, sexCategory);
}
- public Float getMaturity() {
- return maturity;
+ public CaracteristicQualitativeValue getMaturityCategory() {
+ return maturityCategory;
}
- public void setMaturity(Float maturity) {
- Object oldValue = getMaturity();
- this.maturity = maturity;
- firePropertyChange(PROPERTY_MATURITY, oldValue, maturity);
+ public void setMaturityCategory(CaracteristicQualitativeValue maturityCategory) {
+ Object oldValue = getMaturityCategory();
+ this.maturityCategory = maturityCategory;
+ firePropertyChange(PROPERTY_MATURITY_CATEGORY, oldValue, maturityCategory);
}
public Float getAge() {
@@ -353,7 +351,7 @@
this.attachments = attachments;
firePropertyChange(PROPERTY_ATTACHMENTS, oldValue, attachments);
}
-
+
public List<SpeciesFrequencyRowModel> getFrequency() {
return frequency;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -41,11 +41,6 @@
private static final long serialVersionUID = 1L;
- public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
- n_("tutti.table.species.batch.header.toConfirm"),
- n_("tutti.table.species.batch.header.toConfirm"));
-
public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
SpeciesBatchRowModel.PROPERTY_SPECIES,
n_("tutti.table.species.batch.header.speciesByCode"),
@@ -61,20 +56,20 @@
n_("tutti.table.species.batch.header.sortedUnsortedCategory"),
n_("tutti.table.species.batch.header.sortedUnsortedCategory"));
- public static final ColumnIdentifier<SpeciesBatchRowModel> WEIGHT_CATEGORY = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
- n_("tutti.table.species.batch.header.weightCategory"),
- n_("tutti.table.species.batch.header.weightCategory"));
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SIZE_CATEGORY = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SIZE_CATEGORY,
+ n_("tutti.table.species.batch.header.sizeCategory"),
+ n_("tutti.table.species.batch.header.sizeCategory"));
- public static final ColumnIdentifier<SpeciesBatchRowModel> SEX = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SEX,
- n_("tutti.table.species.batch.header.sex"),
- n_("tutti.table.species.batch.header.sex"));
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SEX_CATEGORY = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SEX_CATEGORY,
+ n_("tutti.table.species.batch.header.sexCategory"),
+ n_("tutti.table.species.batch.header.sexCategory"));
- public static final ColumnIdentifier<SpeciesBatchRowModel> MATURITY = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_MATURITY,
- n_("tutti.table.species.batch.header.maturity"),
- n_("tutti.table.species.batch.header.maturity"));
+ public static final ColumnIdentifier<SpeciesBatchRowModel> MATURITY_CATEGORY = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_MATURITY_CATEGORY,
+ n_("tutti.table.species.batch.header.maturityCategory"),
+ n_("tutti.table.species.batch.header.maturityCategory"));
public static final ColumnIdentifier<SpeciesBatchRowModel> AGE = ColumnIdentifier.newId(
SpeciesBatchRowModel.PROPERTY_AGE,
@@ -116,6 +111,10 @@
n_("tutti.table.species.batch.header.file"),
n_("tutti.table.species.batch.header.file"));
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ n_("tutti.table.species.batch.header.toConfirm"),
+ n_("tutti.table.species.batch.header.toConfirm"));
protected final Set<ColumnIdentifier<SpeciesBatchRowModel>> noneEditableColIfNoSpecies;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -28,7 +28,7 @@
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import org.apache.commons.collections.CollectionUtils;
@@ -197,7 +197,8 @@
SpeciesBatchRowModel row = getNodeToRow(node);
if (row != null) {
- SortedUnsortedCategory sortedUnsortedCategory = row.getSortedUnsortedCategory();
+ CaracteristicQualitativeValue sortedUnsortedCategory =
+ row.getSortedUnsortedCategory();
if (sortedUnsortedCategory != null &&
"unsorted".equals(sortedUnsortedCategory.getName())) {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css 2012-12-19 23:24:11 UTC (rev 92)
@@ -30,8 +30,8 @@
}
#totalWeightLabel {
- text: "tutti.label.species.totalWeight";
- labelFor: {totalWeightField};
+ text: "tutti.label.species.totalWeight";
+ labelFor: {totalWeightField};
}
#totalWeightField {
@@ -42,8 +42,8 @@
}
#totalVracWeightLabel {
- text: "tutti.label.species.totalVracWeight";
- labelFor: {totalVracWeightField};
+ text: "tutti.label.species.totalVracWeight";
+ labelFor: {totalVracWeightField};
}
#totalVracWeightField {
@@ -54,8 +54,8 @@
}
#sampleVracWeightLabel {
- text: "tutti.label.species.sampleVracWeight";
- labelFor: {sampleVracWeightField};
+ text: "tutti.label.species.sampleVracWeight";
+ labelFor: {sampleVracWeightField};
}
#sampleVracWeightField {
@@ -66,8 +66,8 @@
}
#totalHorsVracWeightLabel {
- text: "tutti.label.species.totalHorsVracWeight";
- labelFor: {totalHorsVracWeightField};
+ text: "tutti.label.species.totalHorsVracWeight";
+ labelFor: {totalHorsVracWeightField};
}
#totalHorsVracWeightField {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -32,10 +32,9 @@
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.referential.Sex;
-import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
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.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
@@ -73,9 +72,9 @@
public static final Set<String> SAMPLING_PROPERTIES = Sets.newHashSet(
SpeciesBatchRowModel.PROPERTY_SPECIES,
SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SEX,
- SpeciesBatchRowModel.PROPERTY_MATURITY,
+ SpeciesBatchRowModel.PROPERTY_SIZE_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_MATURITY_CATEGORY,
SpeciesBatchRowModel.PROPERTY_AGE);
/**
@@ -97,9 +96,9 @@
SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
SpeciesBatchRowModel.PROPERTY_SPECIES,
SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SEX,
- SpeciesBatchRowModel.PROPERTY_MATURITY,
+ SpeciesBatchRowModel.PROPERTY_SIZE_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_MATURITY_CATEGORY,
SpeciesBatchRowModel.PROPERTY_AGE,
SpeciesBatchRowModel.PROPERTY_WEIGHT,
SpeciesBatchRowModel.PROPERTY_COMMENT,
@@ -154,14 +153,9 @@
DefaultTableColumnModelExt columnModel =
new DefaultTableColumnModelExt();
- {
- // Species to confirm column
+ Decorator<CaracteristicQualitativeValue> caracteristicDecorator =
+ getDecorator(CaracteristicQualitativeValue.class, null);
- addBooleanColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
- getTable());
- }
-
List<Species> allSpecies = persistenceService.getAllSpecies();
{
@@ -191,54 +185,52 @@
// SortedUnsortedCategory column
- Decorator<SortedUnsortedCategory> decorator =
- getDecorator(SortedUnsortedCategory.class, null);
+ Caracteristic data =
+ persistenceService.getSortedUnsortedCaracteristic();
- List<SortedUnsortedCategory> data =
- persistenceService.getAllSortedUnsortedCategory();
-
addComboDataColumnToModel(columnModel,
SpeciesBatchTableModel.SORTED_UNSORTED_CATEGORY,
- decorator, data);
+ caracteristicDecorator,
+ data.getQualitativeValue());
}
{
- // WeightCategory column
+ // SizeCategory column
- Decorator<WeightCategory> decorator =
- getDecorator(WeightCategory.class,
- DecoratorService.BY_NAME);
+ Caracteristic data =
+ persistenceService.getSizeCategoryCaracteristic();
- List<WeightCategory> data =
- persistenceService.getAllWeightCategory();
-
addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.WEIGHT_CATEGORY,
- decorator, data);
+ SpeciesBatchTableModel.SIZE_CATEGORY,
+ caracteristicDecorator,
+ data.getQualitativeValue());
}
{
- // Sex column
+ // SexCategory column
- Decorator<Sex> decorator =
- getDecorator(Sex.class, DecoratorService.BY_NAME);
+ Caracteristic data = persistenceService.getSexCaracteristic();
- List<Sex> data = persistenceService.getAllSex();
-
addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SEX,
- decorator, data);
+ SpeciesBatchTableModel.SEX_CATEGORY,
+ caracteristicDecorator,
+ data.getQualitativeValue());
}
{
- // Maturity column
+ // MaturityCategory column
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.MATURITY,
- TuttiUI.DECIMAL3_PATTERN);
+ Caracteristic data =
+ persistenceService.getMaturityCaracteristic();
+
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.MATURITY_CATEGORY,
+ caracteristicDecorator,
+ data.getQualitativeValue());
}
{
@@ -302,6 +294,13 @@
n_("tutti.tooltip.attachment.none")),
SpeciesBatchTableModel.ATTACHMENTS);
}
+
+ { // Species to confirm column
+
+ addBooleanColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
+ getTable());
+ }
return columnModel;
}
@@ -602,9 +601,9 @@
List<String> samplingOrder = Lists.newArrayList(
SpeciesBatchRowModel.PROPERTY_SPECIES,
SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SEX,
- SpeciesBatchRowModel.PROPERTY_MATURITY,
+ SpeciesBatchRowModel.PROPERTY_SIZE_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_MATURITY_CATEGORY,
SpeciesBatchRowModel.PROPERTY_AGE
);
@@ -691,7 +690,7 @@
Float totalVrac = 0f;
for (SpeciesBatchRowModel batch : getModel().getRows()) {
- SortedUnsortedCategory vracHorsVrac = batch.getSortedUnsortedCategory();
+ CaracteristicQualitativeValue vracHorsVrac = batch.getSortedUnsortedCategory();
if (vracHorsVrac == null) {
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css (from rev 91, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css 2012-12-19 23:24:11 UTC (rev 92)
@@ -0,0 +1,83 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+#splitPane {
+ orientation: {JSplitPane.VERTICAL_SPLIT};
+ resizeWeight: 0.3;
+ oneTouchExpandable: true;
+ continuousLayout: true;
+}
+
+#form {
+ border: {BorderFactory.createTitledBorder((String)null)};
+}
+
+#nameLabel {
+ text: "tutti.label.program.name";
+ labelFor: {nameField};
+}
+
+#nameField {
+ text: {model.getName()};
+}
+
+#commentPane {
+ columnHeaderView: {new JLabel(_("tutti.label.comment"))};
+ minimumSize: {new Dimension(10,50)};
+}
+
+#commentField {
+ text: {getStringValue(model.getComment())};
+}
+
+#saveButton {
+ text: "tutti.action.save";
+ enabled: {model.isModify() && model.isValid()};
+ actionIcon: "save";
+}
+
+#cancelButton {
+ text: "tutti.action.cancel";
+ actionIcon: "cancel";
+}
+
+#messagePanel {
+ border: {BorderFactory.createTitledBorder(_("tutti.title.messages"))};
+ height: 200;
+ width: 500;
+}
+
+#errorTable {
+ rowSelectionAllowed: true;
+ autoCreateRowSorter: true;
+ autoResizeMode: 2;
+ cellSelectionEnabled: false;
+ selectionMode: 0;
+ model: {errorTableModel};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.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/protocol/EditProtocolUI.jaxx (from rev 91, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx 2012-12-19 23:24:11 UTC (rev 92)
@@ -0,0 +1,113 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a 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<EditProtocolUIModel, EditProtocolUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.Zone
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ java.awt.Dimension
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+
+ </import>
+
+ <script><![CDATA[
+
+ public EditProtocolUI(TuttiUIContext context) {
+ EditProtocolUIHandler handler = new EditProtocolUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <EditProtocolUIHandler id='handler'
+ initializer='getContextValue(EditProtocolUIHandler.class)'/>
+
+ <EditProtocolUIModel id='model'
+ initializer='getContextValue(EditProtocolUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='name' component='nameField'/>
+ <field name='comment' component='commentField'/>
+ </BeanValidator>
+
+ <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
+
+ <Table id='form' fill='both'>
+
+ <!-- protocol name -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='nameLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='nameField'
+ onKeyReleased='handler.setText(event, "name")'/>
+ </cell>
+ </row>
+
+ <!-- program comment -->
+ <row weighty='0.8'>
+ <cell columns='2'>
+ <JScrollPane id='commentPane'
+ onFocusGained='commentField.requestFocus()'>
+ <JTextArea id='commentField'
+ onKeyReleased='handler.setText(event, "comment")'/>
+ </JScrollPane>
+ </cell>
+ </row>
+
+ <!-- actions -->
+ <row anchor='south'>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+
+ <!-- validation messages -->
+ <JPanel id='messagePanel' layout='{new GridLayout()}'>
+ <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
+ <JTable id='errorTable' />
+ </JScrollPane>
+ </JPanel>
+ </JSplitPane>
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.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/protocol/EditProtocolUIHandler.java (from rev 91, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -0,0 +1,146 @@
+package fr.ifremer.tutti.ui.swing.content.protocol;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
+import jaxx.runtime.validator.swing.SwingValidatorUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EditProtocolUIHandler.class);
+
+ /**
+ * UI.
+ *
+ * @since 0.3
+ */
+ private final EditProtocolUI ui;
+
+ /**
+ * Persistence service.
+ *
+ * @since 0.3
+ */
+ private final PersistenceService persistenceService;
+
+ public EditProtocolUIHandler(TuttiUIContext context, EditProtocolUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ EditProtocolUIModel model = new EditProtocolUIModel();
+
+ String protocolId = context.getProtocolId();
+ if (protocolId == null) {
+
+ // create new protocol
+
+ if (log.isDebugEnabled()) {
+ log.debug("Will create a new protocol");
+ }
+ } else {
+
+ // load existing program
+ TuttiProtocol protocol =
+ persistenceService.getProtocol(protocolId);
+
+ model.fromBean(protocol);
+ if (log.isDebugEnabled()) {
+ log.debug("Will edit protocol: " + protocolId);
+ }
+ }
+ listModelIsModify(model);
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+
+ EditProtocolUIModel model = ui.getModel();
+
+ SwingValidatorUtil.installUI(ui.getErrorTable(),
+ new SwingValidatorMessageTableRenderer());
+
+ listenValidatorValid(ui.getValidator(), model);
+
+ // if new protocol can already cancel his creation
+ model.setModify(model.isCreate());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected EditProtocolUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void cancel() {
+
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
+ }
+
+ public void save() {
+
+ EditProtocolUIModel model = ui.getModel();
+
+ TuttiProtocol bean = model.toBean();
+
+ TuttiProtocol saved;
+ if (TuttiEntities.isNew(bean)) {
+
+ saved = persistenceService.createProtocol(bean);
+ } else {
+ saved = persistenceService.saveProtocol(bean);
+ }
+
+ context.setProtocolId(saved.getId());
+
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.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/protocol/EditProtocolUIModel.java (from rev 91, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -0,0 +1,80 @@
+package fr.ifremer.tutti.ui.swing.content.protocol;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.protocol.TuttiProtocol;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class EditProtocolUIModel extends AbstractTuttiBeanUIModel<TuttiProtocol, EditProtocolUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_NAME = "name";
+
+ protected String name;
+
+ protected String comment;
+
+ protected static Binder<EditProtocolUIModel, TuttiProtocol> toBeanBinder =
+ BinderFactory.newBinder(EditProtocolUIModel.class,
+ TuttiProtocol.class);
+
+ protected static Binder<TuttiProtocol, EditProtocolUIModel> fromBeanBinder =
+ BinderFactory.newBinder(TuttiProtocol.class, EditProtocolUIModel.class);
+
+
+ public EditProtocolUIModel() {
+ super(TuttiProtocol.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ Object oldValue = getName();
+ this.name = name;
+ firePropertyChange(PROPERTY_NAME, oldValue, name);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.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/protocol/EditProtocolUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.css 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.css 2012-12-19 23:24:11 UTC (rev 92)
@@ -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%
- */
-BeanComboBox {
- showReset: true;
- i18nPrefix: "tutti.property.";
- bean: {model};
-}
-
-#splitPane {
- orientation: {JSplitPane.VERTICAL_SPLIT};
- resizeWeight: 0.3;
- oneTouchExpandable: true;
- continuousLayout: true;
-}
-
-#form {
- border: {BorderFactory.createTitledBorder((String)null)};
-}
-
-#nameLabel {
- text: "tutti.label.program.name";
- labelFor: {nameField};
-}
-
-#nameField {
- text: {model.getName()};
-}
-
-#commentPane {
- columnHeaderView: {new JLabel(_("tutti.label.comment"))};
- minimumSize: {new Dimension(10,50)};
-}
-
-#commentField {
- text: {getStringValue(model.getComment())};
-}
-
-#saveButton {
- text: "tutti.action.save";
- enabled: {model.isModify() && model.isValid()};
- actionIcon: "save";
-}
-
-#cancelButton {
- text: "tutti.action.cancel";
- actionIcon: "cancel";
-}
-
-#messagePanel {
- border: {BorderFactory.createTitledBorder(_("tutti.title.messages"))};
- height: 200;
- width: 500;
-}
-
-#errorTable {
- rowSelectionAllowed: true;
- autoCreateRowSorter: true;
- autoResizeMode: 2;
- cellSelectionEnabled: false;
- selectionMode: 0;
- model: {errorTableModel};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.jaxx 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.jaxx 2012-12-19 23:24:11 UTC (rev 92)
@@ -1,113 +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<EditProtocolUIModel, EditProtocolUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.Zone
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- java.awt.Dimension
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
-
- </import>
-
- <script><![CDATA[
-
- public EditProtocolUI(TuttiUIContext context) {
- EditProtocolUIHandler handler = new EditProtocolUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
- }
-
- protected void $afterCompleteSetup() {
- handler.afterInitUI();
- }
- ]]></script>
-
- <EditProtocolUIHandler id='handler'
- initializer='getContextValue(EditProtocolUIHandler.class)'/>
-
- <EditProtocolUIModel id='model'
- initializer='getContextValue(EditProtocolUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='name' component='nameField'/>
- <field name='comment' component='commentField'/>
- </BeanValidator>
-
- <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
-
- <Table id='form' fill='both'>
-
- <!-- protocol name -->
- <row>
- <cell anchor='west'>
- <JLabel id='nameLabel'/>
- </cell>
- <cell weightx='1.0'>
- <JTextField id='nameField'
- onKeyReleased='handler.setText(event, "name")'/>
- </cell>
- </row>
-
- <!-- program comment -->
- <row weighty='0.8'>
- <cell columns='2'>
- <JScrollPane id='commentPane'
- onFocusGained='commentField.requestFocus()'>
- <JTextArea id='commentField'
- onKeyReleased='handler.setText(event, "comment")'/>
- </JScrollPane>
- </cell>
- </row>
-
- <!-- actions -->
- <row anchor='south'>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1, 0)}'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='saveButton' onActionPerformed='handler.save()'/>
- </JPanel>
- </cell>
- </row>
- </Table>
-
- <!-- validation messages -->
- <JPanel id='messagePanel' layout='{new GridLayout()}'>
- <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
- <JTable id='errorTable' />
- </JScrollPane>
- </JPanel>
- </JSplitPane>
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIHandler.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIHandler.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -1,146 +0,0 @@
-package fr.ifremer.tutti.ui.swing.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
-import jaxx.runtime.validator.swing.SwingValidatorUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(EditProtocolUIHandler.class);
-
- /**
- * UI.
- *
- * @since 0.3
- */
- private final EditProtocolUI ui;
-
- /**
- * Persistence service.
- *
- * @since 0.3
- */
- private final PersistenceService persistenceService;
-
- public EditProtocolUIHandler(TuttiUIContext context, EditProtocolUI ui) {
- super(context);
- this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- EditProtocolUIModel model = new EditProtocolUIModel();
-
- String protocolId = context.getProtocolId();
- if (protocolId == null) {
-
- // create new protocol
-
- if (log.isDebugEnabled()) {
- log.debug("Will create a new protocol");
- }
- } else {
-
- // load existing program
- TuttiProtocol protocol =
- persistenceService.getProtocol(protocolId);
-
- model.fromBean(protocol);
- if (log.isDebugEnabled()) {
- log.debug("Will edit protocol: " + protocolId);
- }
- }
- listModelIsModify(model);
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- initUI(ui);
-
- EditProtocolUIModel model = ui.getModel();
-
- SwingValidatorUtil.installUI(ui.getErrorTable(),
- new SwingValidatorMessageTableRenderer());
-
- listenValidatorValid(ui.getValidator(), model);
-
- // if new protocol can already cancel his creation
- model.setModify(model.isCreate());
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected EditProtocolUIModel getModel() {
- return ui.getModel();
- }
-
- public void cancel() {
-
- context.setScreen(TuttiScreen.SELECT_CRUISE);
- }
-
- public void save() {
-
- EditProtocolUIModel model = ui.getModel();
-
- TuttiProtocol bean = model.toBean();
-
- TuttiProtocol saved;
- if (TuttiEntities.isNew(bean)) {
-
- saved = persistenceService.createProtocol(bean);
- } else {
- saved = persistenceService.saveProtocol(bean);
- }
-
- context.setProtocolId(saved.getId());
-
- context.setScreen(TuttiScreen.SELECT_CRUISE);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIModel.java 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIModel.java 2012-12-19 23:24:11 UTC (rev 92)
@@ -1,80 +0,0 @@
-package fr.ifremer.tutti.ui.swing.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.protocol.TuttiProtocol;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-public class EditProtocolUIModel extends AbstractTuttiBeanUIModel<TuttiProtocol, EditProtocolUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_NAME = "name";
-
- protected String name;
-
- protected String comment;
-
- protected static Binder<EditProtocolUIModel, TuttiProtocol> toBeanBinder =
- BinderFactory.newBinder(EditProtocolUIModel.class,
- TuttiProtocol.class);
-
- protected static Binder<TuttiProtocol, EditProtocolUIModel> fromBeanBinder =
- BinderFactory.newBinder(TuttiProtocol.class, EditProtocolUIModel.class);
-
-
- public EditProtocolUIModel() {
- super(TuttiProtocol.class, fromBeanBinder, toBeanBinder);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- Object oldValue = getName();
- this.name = name;
- firePropertyChange(PROPERTY_NAME, oldValue, name);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
-}
\ No newline at end of file
Added: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel-error-validation.xml (rev 0)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel-error-validation.xml 2012-12-19 23:24:11 UTC (rev 92)
@@ -0,0 +1,35 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="name">
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>tutti.validator.error.protocol.name.required</message>
+ </field-validator>
+ </field>
+
+</validators>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel-error-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-19 15:39:51 UTC (rev 91)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-19 23:24:11 UTC (rev 92)
@@ -84,7 +84,7 @@
tutti.label.fishingOperation.gearShootingStartSurfaceTemperature=Temperature de surface début de traine
tutti.label.fishingOperation.gearTime=Heure
tutti.label.fishingOperation.geometrieMesuree=Géométrie mesurée
-tutti.label.fishingOperation.localite=Localité
+tutti.label.fishingOperation.location=Localité
tutti.label.fishingOperation.longueurBras=Longueur des funes
tutti.label.fishingOperation.longueurFunes=Longueur des bras
tutti.label.fishingOperation.ouvertureHorizontale=Ouverture horizontale
@@ -120,11 +120,16 @@
tutti.label.program.zone=Zone
tutti.label.protocol=Protocol de saisie
tutti.label.species.sampleVracWeight=Poids total vrac échant.
+tutti.label.species.speciesSampleVracWeight=Poids total vrac échantillon
+tutti.label.species.speciesTotalHorsVracWeight=Poids total hors vrac
+tutti.label.species.speciesTotalVracWeight=Poids total vrac
+tutti.label.species.speciesTotalWeight=Poids total
tutti.label.species.totalHorsVracWeight=Poids total hors vrac
tutti.label.species.totalVracWeight=Poids total vrac
tutti.label.species.totalWeight=Poids total
tutti.label.tab.accidentel=Captures accidentelles
tutti.label.tab.benthos=Benthos
+tutti.label.tab.catches=Captures
tutti.label.tab.fishingOperation=Trait
tutti.label.tab.fishingOperation.environment=Environnement
tutti.label.tab.fishingOperation.gearShooting=Mise en oeuvre de l'engin
@@ -156,9 +161,9 @@
tutti.table.accidental.batch.header.speciesByGenusCode=Espèce
tutti.table.accidental.batch.header.weight=Poids observé
tutti.table.benthos.batch.header.comment=Commentaire
-tutti.table.benthos.batch.header.elevationRate=Fraction d'élévation
tutti.table.benthos.batch.header.file=Pièces jointes
tutti.table.benthos.batch.header.sampleWeight=Poids échantillonné
+tutti.table.benthos.batch.header.samplingRatio=Fraction d'élévation
tutti.table.benthos.batch.header.speciesByCode=Espèce
tutti.table.benthos.batch.header.speciesByGenusCode=Espèce
tutti.table.benthos.batch.header.toConfirm=A Confirmer
@@ -189,15 +194,15 @@
tutti.table.species.batch.header.computedWeight=Poids calculé
tutti.table.species.batch.header.elevationRate=Fraction d'élévation
tutti.table.species.batch.header.file=Pièces jointes
-tutti.table.species.batch.header.maturity=Maturité
+tutti.table.species.batch.header.maturityCategory=Maturité
tutti.table.species.batch.header.sampleWeight=Poids échantillonné
-tutti.table.species.batch.header.sex=Sexe
+tutti.table.species.batch.header.sexCategory=Sexe
+tutti.table.species.batch.header.sizeCategory=Catégorie Taille
tutti.table.species.batch.header.sortedUnsortedCategory=Vrac / Hors Vrac
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.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
@@ -238,3 +243,4 @@
tutti.validator.error.fishingOperation.stationNumber.required=Le numéro de station est obligatoire
tutti.validator.error.program.name.required=Le nom de la série est obligatoire
tutti.validator.error.program.zone.required=La zone de la série est obligatoire
+tutti.validator.error.protocol.name.required=Le nom du protocol est obligatoire
1
0
r91 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing/content/operation java/fr/ifremer/tutti/ui/swing/content/operation/fishing java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment resources/i18n
by kmorin@users.forge.codelutin.com Dec. 19, 2012
by kmorin@users.forge.codelutin.com Dec. 19, 2012
Dec. 19, 2012
Author: kmorin
Date: 2012-12-19 16:39:51 +0100 (Wed, 19 Dec 2012)
New Revision: 91
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/91
Log:
use a table instead of a form in the environment tab
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTableModel.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.java
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2012-12-19 10:49:03 UTC (rev 90)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2012-12-19 15:39:51 UTC (rev 91)
@@ -32,7 +32,7 @@
fr.ifremer.tutti.persistence.entities.referential.Person
fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor
- fr.ifremer.tutti.ui.swing.content.operation.fishing.EnvironmentTabUI
+ fr.ifremer.tutti.ui.swing.content.operation.fishing.environment.EnvironmentTabUI
jaxx.runtime.swing.editor.bean.BeanComboBox
jaxx.runtime.swing.editor.bean.BeanListHeader
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-19 10:49:03 UTC (rev 90)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-19 15:39:51 UTC (rev 91)
@@ -24,10 +24,12 @@
* #L%
*/
+import com.google.common.collect.Maps;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.fishing.environment.EnvironmentTabUIModel;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -38,7 +40,10 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;
+import java.util.Map;
+import static org.nuiton.i18n.I18n._;
+
/**
* Handler for UI {@link EditFishingOperationUI}.
*
@@ -97,7 +102,7 @@
ui.getFishingOperationValidPanel().remove(
ui.getFishingOperationResetRadio());
- EditFishingOperationUIModel model = ui.getModel();
+ final EditFishingOperationUIModel model = ui.getModel();
initUI(ui);
@@ -120,7 +125,37 @@
model.setEmpty(true);
listenValidatorValid(ui.getValidator(), getModel());
+
+ EnvironmentTabUIModel environmentModel =
+ ui.getEnvironmentTabContent().getModel();
+ environmentModel.addPropertyChangeListener(
+ EditFishingOperationUIModel.PROPERTY_ENVIRONMENT_PARAMETERS,
+ new PropertyChangeListener() {
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ model.setModify(true);
+ }
+ }
+ );
+ environmentModel.setEnvironmentParameters(getDefaultEnvironmentParams());
}
+
+ protected Map<Object, Object> getDefaultEnvironmentParams() {
+ Map<Object, Object> environmentParams = Maps.newHashMap();
+ environmentParams.put(
+ _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_BEAUFORT_SCALE)),
+ null
+ );
+ environmentParams.put(
+ _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_WIND_DIRECTION)),
+ null
+ );
+ environmentParams.put(
+ _(new String("tutti.table.fishing.environment.keys." + EnvironmentTabUIModel.KEY_SEA_STATE)),
+ null
+ );
+ return environmentParams;
+ }
@Override
public void onCloseUI() {
@@ -155,7 +190,8 @@
// if new fishingOperation can already cancel his creation
model.setModify(!empty && model.isCreate());
- ui.getEnvironmentTabContent().getHandler().afterInitUI();
+ ui.getEnvironmentTabContent().getModel().setEnvironmentParameters(getDefaultEnvironmentParams());
+ ui.getEnvironmentTabContent().getHandler().reset();
}
public void cancel() {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-19 10:49:03 UTC (rev 90)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-19 15:39:51 UTC (rev 91)
@@ -26,9 +26,7 @@
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.SeaState;
import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import fr.ird.type.SexagecimalPosition;
@@ -37,6 +35,7 @@
import java.util.Date;
import java.util.List;
+import java.util.Map;
/**
* Model for UI {@link EditFishingOperationUI}.
@@ -76,12 +75,14 @@
public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth";
- public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale";
+// public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale";
+//
+// public static final String PROPERTY_WIND_DIRECTION = "windDirection";
+//
+// public static final String PROPERTY_SEA_STATE = "seaState";
+
+ public static final String PROPERTY_ENVIRONMENT_PARAMETERS = "environmentParameters";
- public static final String PROPERTY_WIND_DIRECTION = "windDirection";
-
- public static final String PROPERTY_SEA_STATE = "seaState";
-
public static final String PROPERTY_OUVERTURE_HORIZONTALE = "ouvertureHorizontale";
public static final String PROPERTY_OUVERTURE_VERTICALE = "ouvertureVerticale";
@@ -172,12 +173,14 @@
protected Float gearShootingEndDepth;
- protected BeaufortScale beaufortScale;
+// protected BeaufortScale beaufortScale;
+//
+// protected Integer windDirection;
+//
+// protected SeaState seaState;
+
+ protected Map<Object, Object> environmentParameters;
- protected Integer windDirection;
-
- protected SeaState seaState;
-
protected Float ouvertureHorizontale;
protected Float ouvertureVerticale;
@@ -383,36 +386,46 @@
firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth);
}
- public BeaufortScale getBeaufortScale() {
- return beaufortScale;
+// public BeaufortScale getBeaufortScale() {
+// return beaufortScale;
+// }
+//
+// public void setBeaufortScale(BeaufortScale beaufortScale) {
+// Object oldValue = getBeaufortScale();
+// this.beaufortScale = beaufortScale;
+// firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale);
+// }
+//
+// public Integer getWindDirection() {
+// return windDirection;
+// }
+//
+// public void setWindDirection(Integer windDirection) {
+// Object oldValue = getWindDirection();
+// this.windDirection = windDirection;
+// firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection);
+// }
+//
+// public SeaState getSeaState() {
+// return seaState;
+// }
+//
+// public void setSeaState(SeaState seaState) {
+// Object oldValue = getSeaState();
+// this.seaState = seaState;
+// firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState);
+// }
+
+ public Map<Object, Object> getEnvironmentParameters() {
+ return environmentParameters;
}
-
- public void setBeaufortScale(BeaufortScale beaufortScale) {
- Object oldValue = getBeaufortScale();
- this.beaufortScale = beaufortScale;
- firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale);
+
+ public void setEnvironmentParameters(Map<Object, Object> environmentParameters) {
+ Object oldValue = getEnvironmentParameters();
+ this.environmentParameters = environmentParameters;
+ firePropertyChange(PROPERTY_ENVIRONMENT_PARAMETERS, oldValue, environmentParameters);
}
- public Integer getWindDirection() {
- return windDirection;
- }
-
- public void setWindDirection(Integer windDirection) {
- Object oldValue = getWindDirection();
- this.windDirection = windDirection;
- firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection);
- }
-
- public SeaState getSeaState() {
- return seaState;
- }
-
- public void setSeaState(SeaState seaState) {
- Object oldValue = getSeaState();
- this.seaState = seaState;
- firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState);
- }
-
public Float getOuvertureHorizontale() {
return ouvertureHorizontale;
}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java 2012-12-19 10:49:03 UTC (rev 90)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java 2012-12-19 15:39:51 UTC (rev 91)
@@ -1,94 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.fishing;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.AbstractTuttiBeanUIModel;
-import java.io.Serializable;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-/**
- *
- * @author kmorin
- * @since 0.3
- */
-public class EnvironmentRowModel extends AbstractTuttiBeanUIModel<Object, EnvironmentRowModel> {
-
- public static final String PROPERTY_KEY = "key";
- public static final String PROPERTY_VALUE = "value";
-
- protected static final Binder<Object, EnvironmentRowModel> fromBeanBinder =
- BinderFactory.newBinder(Object.class,
- EnvironmentRowModel.class);
-
- protected static final Binder<EnvironmentRowModel, Object> toBeanBinder =
- BinderFactory.newBinder(EnvironmentRowModel.class,
- Object.class);
-
- protected String key;
-
- protected String value;
-
- public EnvironmentRowModel() {
- super(Object.class, fromBeanBinder, toBeanBinder);
- }
-
- public EnvironmentRowModel(String key) {
- this();
- this.key = key;
- }
-//
-// public FishingOperationEnvironmentRowModel(Object o,
-// List<SpeciesBatchFrequency> frequencies) {
-// this();
-// fromBean(aBatch);
-// List<SpeciesFrequencyRowModel> frequencyRows =
-// SpeciesFrequencyRowModel.fromBeans(frequencies);
-// frequency.addAll(frequencyRows);
-// Collections.sort(frequency);
-// updateTotalFromFrequencies();
-// }
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- Object oldValue = getKey();
- this.key = key;
- firePropertyChange(PROPERTY_KEY, oldValue, key);
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- Object oldValue = getValue();
- this.value = value;
- firePropertyChange(PROPERTY_VALUE, oldValue, value);
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css 2012-12-19 10:49:03 UTC (rev 90)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css 2012-12-19 15:39:51 UTC (rev 91)
@@ -1,29 +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%
- */
-#environmentTable {
- selectionMode: {ListSelectionModel.SINGLE_SELECTION};
- selectionBackground: {null};
- selectionForeground: {Color.BLACK};
- sortable: false;
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx 2012-12-19 10:49:03 UTC (rev 90)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx 2012-12-19 15:39:51 UTC (rev 91)
@@ -1,69 +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%
- -->
-<Table implements='fr.ifremer.tutti.ui.swing.TuttiUI<EnvironmentTabUIModel, EnvironmentTabUIHandler>'>
-
- <import>
- org.jdesktop.swingx.JXTable
- fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI
- javax.swing.ListSelectionModel
- java.awt.Color
- </import>
-
- <EnvironmentTabUIHandler id='handler'
- initializer='getContextValue(EnvironmentTabUIHandler.class)'/>
-
- <EnvironmentTabUIModel id='model'
- initializer='getContextValue(EnvironmentTabUIModel.class)'/>
-
- <row fill='both'>
- <cell fill='both' weightx='1'>
- <JComboBox id='newRowKey'/>
- </cell>
- <cell fill='both'>
- <JButton id='addRow' actionIcon='add'
- onActionPerformed='handler.addRow()'/>
- </cell>
- </row>
- <row fill='both' weighty='1'>
- <cell fill='both' columns='2'>
- <JScrollPane>
- <JXTable id='environmentTable'/>
- </JScrollPane>
- </cell>
- </row>
- <script><![CDATA[
-
-public EnvironmentTabUI(EditFishingOperationUI parentUI) {
- EnvironmentTabUIHandler handler = new EnvironmentTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-protected void $afterCompleteSetup() {
- handler.afterInitUI();
-}
-
- ]]></script>
-
-</Table>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java 2012-12-19 10:49:03 UTC (rev 90)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java 2012-12-19 15:39:51 UTC (rev 91)
@@ -1,192 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.fishing;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.content.operation.EditFishingOperationUI;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.List;
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.JComboBox;
-import javax.swing.event.ListDataEvent;
-import javax.swing.event.ListDataListener;
-import javax.swing.table.TableColumnModel;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
-
-/**
- *
- * @author kmorin
- * @since 0.3
- */
-public class EnvironmentTabUIHandler extends AbstractTuttiTableUIHandler<EnvironmentRowModel, EnvironmentTabUIModel> {
-
- private final static Log log = LogFactory.getLog(EnvironmentTabUIHandler.class);
-
- protected EnvironmentTabUI ui;
-
- public EnvironmentTabUIHandler(EditFishingOperationUI parentUi, EnvironmentTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- }
-
- @Override
- protected JXTable getTable() {
- return ui.getEnvironmentTable();
- }
-
- @Override
- protected AbstractTuttiTableModel<EnvironmentRowModel> getTableModel() {
- return (EnvironmentTableModel) getTable().getModel();
- }
-
- @Override
- protected TableColumnModel createTableColumnModel() {
- DefaultTableColumnModelExt columnModel =
- new DefaultTableColumnModelExt();
-
- {
-
- addColumnToModel(columnModel, EnvironmentTableModel.KEY);
- }
-
- {
-
- addColumnToModel(columnModel, EnvironmentTableModel.VALUE);
- }
-
-
- return columnModel;
- }
-
- @Override
- protected void onRowModified(EnvironmentRowModel row, String propertyName, Object oldValue, Object newValue) {
- }
-
- @Override
- protected void onRowValidStateChanged(EnvironmentRowModel row, Boolean oldValue, Boolean newValue) {
- }
-
- @Override
- protected void onRowModifyStateChanged(EnvironmentRowModel row, Boolean oldValue, Boolean newValue) {
- }
-
- @Override
- public void beforeInitUI() {
- EnvironmentTabUIModel model = new EnvironmentTabUIModel();
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
- initUI(ui);
-
- JXTable table = getTable();
-
- // create table column model
- TableColumnModel columnModel = createTableColumnModel();
-
- // create table model
- EnvironmentTableModel tableModel =
- new EnvironmentTableModel(columnModel);
-
- table.setModel(tableModel);
- table.setColumnModel(columnModel);
-
- final JComboBox keyCombo = ui.getNewRowKey();
- keyCombo.setModel(new DefaultComboBoxModel());
-
- keyCombo.addItemListener(new ItemListener() {
-
- public void itemStateChanged(ItemEvent e) {
- log.debug("item state changed " + e.paramString());
- }
- });
- keyCombo.getModel().addListDataListener(new ListDataListener() {
-
- public void intervalAdded(ListDataEvent e) {
- keyCombo.setEnabled(true);
- ui.getAddRow().setEnabled(true);
- }
-
- public void intervalRemoved(ListDataEvent e) {
- if (keyCombo.getItemCount() == 0) {
- keyCombo.setEnabled(false);
- ui.getAddRow().setEnabled(false);
- }
- }
-
- public void contentsChanged(ListDataEvent e) {
- keyCombo.setEnabled(true);
- ui.getAddRow().setEnabled(true);
- }
- });
-
- reset();
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected EnvironmentTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void addRow() {
- JComboBox keyCombo = ui.getNewRowKey();
- String key = (String) keyCombo.getSelectedItem();
- EnvironmentRowModel row = new EnvironmentRowModel(key);
- getTableModel().addNewRow(getTable().getRowCount(), row);
-
- keyCombo.removeItem(key);
- }
-
- public void reset() {
- List<EnvironmentRowModel> rows = Lists.newArrayList();
- List<String> defaultKeys = Lists.newArrayList(ui.getModel().getDefaultKeys());
- for (String key : defaultKeys) {
- rows.add(new EnvironmentRowModel(key));
- }
-
- AbstractTuttiTableModel<EnvironmentRowModel> tableModel = getTableModel();
- tableModel.setRows(rows);
-
- JComboBox keyCombo = ui.getNewRowKey();
- DefaultComboBoxModel keyComboModel = (DefaultComboBoxModel)keyCombo.getModel();
- for (String key : ui.getModel().getKeys()) {
- if (!defaultKeys.contains(key)) {
- keyComboModel.addElement(key);
- }
- }
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java 2012-12-19 10:49:03 UTC (rev 90)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java 2012-12-19 15:39:51 UTC (rev 91)
@@ -1,83 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.fishing;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderModelBuilder;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- *
- * @author kmorin
- */
-public class EnvironmentTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, EnvironmentRowModel, EnvironmentTabUIModel> {
-
- protected FishingOperation fishingOperation;
-
- public static final String KEY_BEAUFORT_SCALE = "beaufortScale";
- public static final String KEY_WIND_DIRECTION = "windDirection";
- public static final String KEY_SEA_STATE = "seaState";
-
- protected static final Binder<FishingOperation, EnvironmentTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, EnvironmentTabUIModel.class)
- .toBinder();
-
- protected static final Binder<EnvironmentTabUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(EnvironmentTabUIModel.class, FishingOperation.class)
- .toBinder();
-
- public EnvironmentTabUIModel() {
- super(FishingOperation.class, fromBeanBinder, toBeanBinder);
- }
-
- public FishingOperation getFishingOperation() {
- return fishingOperation;
- }
-
- public void setFishingOperation(FishingOperation fishingOperation) {
- this.fishingOperation = fishingOperation;
- }
-
- public String[] getKeys() {
- return new String[] {
- _("tutti.table.fishing.environment.keys." + KEY_BEAUFORT_SCALE),
- _("tutti.table.fishing.environment.keys." + KEY_WIND_DIRECTION),
- _("tutti.table.fishing.environment.keys." + KEY_SEA_STATE),
- _("tutti.table.fishing.environment.keys." + "key3"),
- _("tutti.table.fishing.environment.keys." + "key4"),
- _("tutti.table.fishing.environment.keys." + "key5")
- };
- }
-
- public String[] getDefaultKeys() {
- return new String[] {
- _("tutti.table.fishing.environment.keys." + KEY_BEAUFORT_SCALE),
- _("tutti.table.fishing.environment.keys." + KEY_WIND_DIRECTION),
- _("tutti.table.fishing.environment.keys." + KEY_SEA_STATE)
- };
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.java 2012-12-19 10:49:03 UTC (rev 90)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.java 2012-12-19 15:39:51 UTC (rev 91)
@@ -1,62 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.fishing;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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 fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-import javax.swing.table.TableColumnModel;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- *
- * @author kmorin
- * since 0.3
- */
-public class EnvironmentTableModel extends AbstractTuttiTableModel<EnvironmentRowModel> {
-
- public static final ColumnIdentifier<EnvironmentRowModel> KEY = ColumnIdentifier.newId(
- EnvironmentRowModel.PROPERTY_KEY,
- n_("tutti.table.fishing.environment.header.key"),
- n_("tutti.table.fishing.environment.header.key"));
-
- public static final ColumnIdentifier<EnvironmentRowModel> VALUE = ColumnIdentifier.newId(
- EnvironmentRowModel.PROPERTY_VALUE,
- n_("tutti.table.fishing.environment.header.value"),
- n_("tutti.table.fishing.environment.header.value"));
-
- public EnvironmentTableModel(TableColumnModel columnModel) {
- super(columnModel);
-
- setNoneEditableCols(KEY);
- }
-
- @Override
- protected EnvironmentRowModel createNewRow() {
- EnvironmentRowModel result = new EnvironmentRowModel();
- return result;
- }
-
-}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java (from rev 90, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentRowModel.java 2012-12-19 15:39:51 UTC (rev 91)
@@ -0,0 +1,87 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing.environment;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.AbstractTuttiBeanUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ *
+ * @author kmorin
+ * @since 0.3
+ */
+public class EnvironmentRowModel extends AbstractTuttiBeanUIModel<Object, EnvironmentRowModel> {
+
+ private static final Log log = LogFactory.getLog(EnvironmentRowModel.class);
+
+ public static final String PROPERTY_KEY = "key";
+ public static final String PROPERTY_VALUE = "value";
+
+ protected static final Binder<Object, EnvironmentRowModel> fromBeanBinder =
+ BinderFactory.newBinder(Object.class,
+ EnvironmentRowModel.class);
+
+ protected static final Binder<EnvironmentRowModel, Object> toBeanBinder =
+ BinderFactory.newBinder(EnvironmentRowModel.class,
+ Object.class);
+
+ protected String key;
+
+ protected String value;
+
+ public EnvironmentRowModel() {
+ super(Object.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public EnvironmentRowModel(String key) {
+ this();
+ this.key = key;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ Object oldValue = getKey();
+ this.key = key;
+ firePropertyChange(PROPERTY_KEY, oldValue, key);
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ log.info(">>>>>>>>>>>>>>< setValue " + value);
+ Object oldValue = getValue();
+ this.value = value;
+ firePropertyChange(PROPERTY_VALUE, oldValue, value);
+ }
+
+}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUI.css (from rev 90, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUI.css 2012-12-19 15:39:51 UTC (rev 91)
@@ -0,0 +1,29 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+#environmentTable {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
\ No newline at end of file
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUI.jaxx (from rev 90, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUI.jaxx 2012-12-19 15:39:51 UTC (rev 91)
@@ -0,0 +1,69 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<Table implements='fr.ifremer.tutti.ui.swing.TuttiUI<EnvironmentTabUIModel, EnvironmentTabUIHandler>'>
+
+ <import>
+ org.jdesktop.swingx.JXTable
+ fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI
+ javax.swing.ListSelectionModel
+ java.awt.Color
+ </import>
+
+ <EnvironmentTabUIHandler id='handler'
+ initializer='getContextValue(EnvironmentTabUIHandler.class)'/>
+
+ <EnvironmentTabUIModel id='model'
+ initializer='getContextValue(EnvironmentTabUIModel.class)'/>
+
+ <row fill='both'>
+ <cell fill='both' weightx='1'>
+ <JComboBox id='newRowKey'/>
+ </cell>
+ <cell fill='both'>
+ <JButton id='addRow' actionIcon='add'
+ onActionPerformed='handler.addRow()'/>
+ </cell>
+ </row>
+ <row fill='both' weighty='1'>
+ <cell fill='both' columns='2'>
+ <JScrollPane>
+ <JXTable id='environmentTable'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <script><![CDATA[
+
+public EnvironmentTabUI(EditFishingOperationUI parentUI) {
+ EnvironmentTabUIHandler handler = new EnvironmentTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+}
+
+ ]]></script>
+
+</Table>
\ No newline at end of file
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java (from rev 90, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java 2012-12-19 15:39:51 UTC (rev 91)
@@ -0,0 +1,221 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing.environment;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.content.operation.EditFishingOperationUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableColumnModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+
+/**
+ *
+ * @author kmorin
+ * @since 0.3
+ */
+public class EnvironmentTabUIHandler extends AbstractTuttiTableUIHandler<EnvironmentRowModel, EnvironmentTabUIModel> {
+
+ private final static Log log = LogFactory.getLog(EnvironmentTabUIHandler.class);
+
+ protected EnvironmentTabUI ui;
+
+ public EnvironmentTabUIHandler(EditFishingOperationUI parentUi, EnvironmentTabUI ui) {
+ super(parentUi.getHandler().getContext(), EnvironmentRowModel.PROPERTY_VALUE);
+ this.ui = ui;
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getEnvironmentTable();
+ }
+
+ @Override
+ protected AbstractTuttiTableModel<EnvironmentRowModel> getTableModel() {
+ return (EnvironmentTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ {
+
+ addColumnToModel(columnModel, EnvironmentTableModel.KEY);
+ }
+
+ {
+
+ addColumnToModel(columnModel, EnvironmentTableModel.VALUE);
+ }
+
+
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(EnvironmentRowModel row, String propertyName, Object oldValue, Object newValue) {
+ }
+
+ @Override
+ protected void onRowValidStateChanged(EnvironmentRowModel row, Boolean oldValue, Boolean newValue) {
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(EnvironmentRowModel row, Boolean oldValue, Boolean newValue) {
+ }
+
+ @Override
+ public void beforeInitUI() {
+ EnvironmentTabUIModel model = new EnvironmentTabUIModel();
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ EnvironmentTableModel tableModel =
+ new EnvironmentTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ final JComboBox keyCombo = ui.getNewRowKey();
+ keyCombo.setModel(new DefaultComboBoxModel());
+
+ keyCombo.addItemListener(new ItemListener() {
+
+ public void itemStateChanged(ItemEvent e) {
+ log.debug("item state changed " + e.paramString());
+ }
+ });
+ keyCombo.getModel().addListDataListener(new ListDataListener() {
+
+ public void intervalAdded(ListDataEvent e) {
+ keyCombo.setEnabled(true);
+ ui.getAddRow().setEnabled(true);
+ }
+
+ public void intervalRemoved(ListDataEvent e) {
+ if (keyCombo.getItemCount() == 0) {
+ keyCombo.setEnabled(false);
+ ui.getAddRow().setEnabled(false);
+ }
+ }
+
+ public void contentsChanged(ListDataEvent e) {
+ keyCombo.setEnabled(true);
+ ui.getAddRow().setEnabled(true);
+ }
+ });
+
+ // modify the model when the user enters a value
+ ListSelectionListener listener = new TableRowModificationListener<EnvironmentRowModel>(
+ tableModel, getRowMonitor()) {
+
+ @Override
+ protected void saveSelectedRow() {
+ TuttiBeanMonitor<EnvironmentRowModel> monitor = getRowMonitor();
+ EnvironmentRowModel row = monitor.getBean();
+ if (row != null) {
+ ui.getModel().setParameter(row.getKey(), row.getValue());
+ }
+ }
+ };
+ table.getSelectionModel().addListSelectionListener(listener);
+
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected EnvironmentTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ /**
+ * Adds a row with the parameter selected in the combo box
+ */
+ public void addRow() {
+ JComboBox keyCombo = ui.getNewRowKey();
+ String key = (String) keyCombo.getSelectedItem();
+ EnvironmentRowModel row = new EnvironmentRowModel(key);
+ getTableModel().addNewRow(getTable().getRowCount(), row);
+ ui.getModel().setParameter(key, null);
+
+ keyCombo.removeItem(key);
+ }
+
+ /**
+ * Resets the table with the data from the database
+ */
+ public void reset() {
+ Map<Object, Object> environmentParameters = ui.getModel().getEnvironmentParameters();
+
+ List<EnvironmentRowModel> rows = Lists.newArrayList();
+ Collection<Object> params = environmentParameters.keySet();
+ for (Object key : environmentParameters.keySet()) {
+ rows.add(new EnvironmentRowModel(key.toString()));
+ }
+
+ AbstractTuttiTableModel<EnvironmentRowModel> tableModel = getTableModel();
+ tableModel.setRows(rows);
+
+ JComboBox keyCombo = ui.getNewRowKey();
+ DefaultComboBoxModel keyComboModel = (DefaultComboBoxModel) keyCombo.getModel();
+ keyComboModel.removeAllElements();
+ for (String param : ui.getModel().getKeys()) {
+ if (!params.contains(param)) {
+ keyComboModel.addElement(param);
+ }
+ }
+ }
+
+}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java (from rev 90, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIModel.java 2012-12-19 15:39:51 UTC (rev 91)
@@ -0,0 +1,83 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing.environment;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.util.Map;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+import java.util.HashMap;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderModelBuilder;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ *
+ * @author kmorin
+ */
+public class EnvironmentTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, EnvironmentRowModel, EnvironmentTabUIModel> {
+
+ protected Map<Object, Object> environmentParameters;
+
+ public static final String KEY_BEAUFORT_SCALE = "beaufortScale";
+ public static final String KEY_WIND_DIRECTION = "windDirection";
+ public static final String KEY_SEA_STATE = "seaState";
+
+ protected static final Binder<FishingOperation, EnvironmentTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, EnvironmentTabUIModel.class)
+ .toBinder();
+
+ protected static final Binder<EnvironmentTabUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(EnvironmentTabUIModel.class, FishingOperation.class)
+ .toBinder();
+
+ public EnvironmentTabUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public Map<Object, Object> getEnvironmentParameters() {
+ return environmentParameters;
+ }
+
+ public void setEnvironmentParameters(Map<Object, Object> environmentParameters) {
+ this.environmentParameters = environmentParameters;
+ }
+
+ public void setParameter(Object param, Object value) {
+ Object oldValue = new HashMap<Object, Object>(environmentParameters);
+ environmentParameters.put(param, value);
+ firePropertyChange(EditFishingOperationUIModel.PROPERTY_ENVIRONMENT_PARAMETERS, oldValue, environmentParameters);
+ }
+
+ public String[] getKeys() {
+ return new String[] {
+ _(new String("tutti.table.fishing.environment.keys." + KEY_BEAUFORT_SCALE)),
+ _(new String("tutti.table.fishing.environment.keys." + KEY_WIND_DIRECTION)),
+ _(new String("tutti.table.fishing.environment.keys." + KEY_SEA_STATE)),
+ _(new String("tutti.table.fishing.environment.keys." + "key3")),
+ _(new String("tutti.table.fishing.environment.keys." + "key4")),
+ _(new String("tutti.table.fishing.environment.keys." + "key5"))
+ };
+ }
+}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTableModel.java (from rev 90, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTableModel.java 2012-12-19 15:39:51 UTC (rev 91)
@@ -0,0 +1,62 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing.environment;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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 fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import javax.swing.table.TableColumnModel;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ *
+ * @author kmorin
+ * since 0.3
+ */
+public class EnvironmentTableModel extends AbstractTuttiTableModel<EnvironmentRowModel> {
+
+ public static final ColumnIdentifier<EnvironmentRowModel> KEY = ColumnIdentifier.newId(
+ EnvironmentRowModel.PROPERTY_KEY,
+ n_("tutti.table.fishing.environment.header.key"),
+ n_("tutti.table.fishing.environment.header.key"));
+
+ public static final ColumnIdentifier<EnvironmentRowModel> VALUE = ColumnIdentifier.newId(
+ EnvironmentRowModel.PROPERTY_VALUE,
+ n_("tutti.table.fishing.environment.header.value"),
+ n_("tutti.table.fishing.environment.header.value"));
+
+ public EnvironmentTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols(KEY);
+ }
+
+ @Override
+ protected EnvironmentRowModel createNewRow() {
+ EnvironmentRowModel result = new EnvironmentRowModel();
+ return result;
+ }
+
+}
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-19 10:49:03 UTC (rev 90)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-19 15:39:51 UTC (rev 91)
@@ -165,7 +165,6 @@
tutti.table.benthos.batch.header.weight=Poids
tutti.table.fishing.environment.header.key=Clé
tutti.table.fishing.environment.header.value=Valeur
-tutti.table.fishing.environment.keys.=
tutti.table.fishing.environment.keys.beaufortScale=Force du vent
tutti.table.fishing.environment.keys.key3=Clé 3
tutti.table.fishing.environment.keys.key4=Clé 4
1
0
r90 - in trunk: . tutti-persistence/src/main/resources/META-INF/services tutti-persistence/src/main/xmi tutti-ui-swing tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation
by tchemit@users.forge.codelutin.com Dec. 19, 2012
by tchemit@users.forge.codelutin.com Dec. 19, 2012
Dec. 19, 2012
Author: tchemit
Date: 2012-12-19 11:49:03 +0100 (Wed, 19 Dec 2012)
New Revision: 90
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/90
Log:
fix build + model for pmfm + add msaccessimporter lib
Modified:
trunk/pom.xml
trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-ui-swing/pom.xml
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-12-19 10:16:51 UTC (rev 89)
+++ trunk/pom.xml 2012-12-19 10:49:03 UTC (rev 90)
@@ -98,6 +98,8 @@
<slf4jVersion>1.7.2</slf4jVersion>
<adagioVersion>3.3.1-SNAPSHOT</adagioVersion>
+
+ <msaccessImporterVersion>1.4.1</msaccessImporterVersion>
<i18n.bundles>fr_FR</i18n.bundles>
<i18n.silent>true</i18n.silent>
@@ -247,6 +249,23 @@
<classifier>allegro</classifier>
</dependency>
+ <dependency>
+ <groupId>fr.ird</groupId>
+ <artifactId>msaccess-importer</artifactId>
+ <version>${msaccessImporterVersion}</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>com.healthmarketscience.jackcess</groupId>
+ <artifactId>jackcess</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.nuiton.topia</groupId>
+ <artifactId>topia-persistence</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
<!-- base h2 -->
<dependency>
<groupId>com.h2database</groupId>
Modified: trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
===================================================================
--- trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-19 10:16:51 UTC (rev 89)
+++ trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-19 10:49:03 UTC (rev 90)
@@ -10,10 +10,12 @@
fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency
fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol
fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
+fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue
fr.ifremer.tutti.persistence.entities.referential.Country
fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation
fr.ifremer.tutti.persistence.entities.referential.Gear
fr.ifremer.tutti.persistence.entities.referential.MacroWasteCategory
+fr.ifremer.tutti.persistence.entities.referential.MeasurementCaracteristic
fr.ifremer.tutti.persistence.entities.referential.Person
fr.ifremer.tutti.persistence.entities.referential.SeaState
fr.ifremer.tutti.persistence.entities.referential.Sex
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-ui-swing/pom.xml
===================================================================
--- trunk/tutti-ui-swing/pom.xml 2012-12-19 10:16:51 UTC (rev 89)
+++ trunk/tutti-ui-swing/pom.xml 2012-12-19 10:49:03 UTC (rev 90)
@@ -198,6 +198,11 @@
</dependency>
<dependency>
+ <groupId>fr.ird</groupId>
+ <artifactId>msaccess-importer</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils</artifactId>
</dependency>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2012-12-19 10:16:51 UTC (rev 89)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2012-12-19 10:49:03 UTC (rev 90)
@@ -100,7 +100,8 @@
<JLabel id='stationNumberLabel'/>
</cell>
<cell weightx='0.3'>
- <NumberEditor id='stationNumberField' constructorParams='this'/>
+ <JTextField id='stationNumberField'
+ onKeyReleased='handler.setText(event, "stationNumber")'/>
</cell>
<cell>
<JLabel id='fishingOperationNumberLabel'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-19 10:16:51 UTC (rev 89)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-19 10:49:03 UTC (rev 90)
@@ -31,6 +31,7 @@
import fr.ifremer.tutti.persistence.entities.referential.SeaState;
import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import fr.ird.type.SexagecimalPosition;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -131,7 +132,7 @@
protected Cruise cruise;
- protected Integer stationNumber;
+ protected String stationNumber;
protected Integer fishingOperationNumber;
@@ -141,6 +142,16 @@
protected FishingOperationLocation subStrata;
+ protected SexagecimalPosition gearShootingStartLatitudeAsSexagecimal;
+
+ protected SexagecimalPosition gearShootingStartLongitudeAsSexagecimal;
+
+ protected SexagecimalPosition gearShootingEndLatitudeAsSexagecimal;
+
+ protected SexagecimalPosition gearShootingEndLongitudeAsSexagecimal;
+
+ protected boolean useSexagecimalFormat;
+
protected Float gearShootingStartLatitude;
protected Float gearShootingStartLongitude;
@@ -242,11 +253,11 @@
this.cruise = cruise;
}
- public Integer getStationNumber() {
+ public String getStationNumber() {
return stationNumber;
}
- public void setStationNumber(Integer stationNumber) {
+ public void setStationNumber(String stationNumber) {
Object oldValue = getStationNumber();
this.stationNumber = stationNumber;
firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber);
1
0
Dec. 19, 2012
Author: tchemit
Date: 2012-12-19 11:16:51 +0100 (Wed, 19 Dec 2012)
New Revision: 89
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/89
Log:
use a FishingOperationLocation instead of a Strata entity + refs #1813: [Ecran Trait] Am?\195?\169lioration du formulaire
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-error-validation.xml
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml
Modified:
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.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-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-19 10:16:51 UTC (rev 89)
@@ -43,7 +43,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.Strata;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -85,7 +85,7 @@
List<SeaState> getAllSeaState();
- List<Strata> getAllStrata();
+ List<FishingOperationLocation> getAllStrata();
List<BeaufortScale> getAllBeaufortScale();
Modified: trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
===================================================================
--- trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-19 10:16:51 UTC (rev 89)
@@ -11,6 +11,7 @@
fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol
fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
fr.ifremer.tutti.persistence.entities.referential.Country
+fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation
fr.ifremer.tutti.persistence.entities.referential.Gear
fr.ifremer.tutti.persistence.entities.referential.MacroWasteCategory
fr.ifremer.tutti.persistence.entities.referential.Person
@@ -18,7 +19,6 @@
fr.ifremer.tutti.persistence.entities.referential.Sex
fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory
fr.ifremer.tutti.persistence.entities.referential.Species
-fr.ifremer.tutti.persistence.entities.referential.Strata
fr.ifremer.tutti.persistence.entities.referential.Vessel
fr.ifremer.tutti.persistence.entities.referential.WeightCategory
fr.ifremer.tutti.persistence.entities.referential.Zone
\ No newline at end of file
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java 2012-12-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java 2012-12-19 10:16:51 UTC (rev 89)
@@ -44,7 +44,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.Strata;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -116,7 +116,7 @@
}
@Override
- public List<Strata> getAllStrata() {
+ public List<FishingOperationLocation> getAllStrata() {
return null;
}
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-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-12-19 10:16:51 UTC (rev 89)
@@ -35,7 +35,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.Strata;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -315,8 +315,8 @@
return getData(Person.class);
}
- public List<Strata> strata() {
- return getData(Strata.class);
+ public List<FishingOperationLocation> strata() {
+ return getData(FishingOperationLocation.class);
}
public List<SeaState> seaState() {
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-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-19 10:16:51 UTC (rev 89)
@@ -55,7 +55,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.Strata;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -243,8 +243,8 @@
}
@Override
- public List<Strata> getAllStrata() {
- List<Strata> result = getDataInNewList(Strata.class);
+ public List<FishingOperationLocation> getAllStrata() {
+ List<FishingOperationLocation> result = getDataInNewList(FishingOperationLocation.class);
return result;
}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-19 10:16:51 UTC (rev 89)
@@ -38,7 +38,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.Strata;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -101,7 +101,7 @@
registerMultiJXPathDecorator(Person.class, "${firstName}$s#${lastName}$s", SEPARATOR, " ");
registerMultiJXPathDecorator(BeaufortScale.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(SeaState.class, "${name}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(Strata.class, "${name}$s", SEPARATOR, " - ");
+ registerMultiJXPathDecorator(FishingOperationLocation.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(Sex.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(SortedUnsortedCategory.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(MacroWasteCategory.class, "${name}$s", SEPARATOR, " - ");
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-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-19 10:16:51 UTC (rev 89)
@@ -45,7 +45,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.SortedUnsortedCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.Strata;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -202,7 +202,7 @@
}
@Override
- public List<Strata> getAllStrata() {
+ public List<FishingOperationLocation> getAllStrata() {
checkDriverExists();
return driver.getAllStrata();
}
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-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-12-19 10:16:51 UTC (rev 89)
@@ -9,7 +9,6 @@
tutti.property.country=Pays
tutti.property.cruise=Campagne
tutti.property.date=Date
-tutti.property.protocol=Protocol de saisie
tutti.property.firstName=Prénom
tutti.property.fishingOperation=Trait
tutti.property.gear=Engin
@@ -18,6 +17,7 @@
tutti.property.macroWasteCategory=Type de macro déchet
tutti.property.name=Nom
tutti.property.program=Série de campagne
+tutti.property.protocol=Protocol de saisie
tutti.property.seaState=État de la mer
tutti.property.sortedUnsortedCategory=Vrac / Hors Vrac
tutti.property.stationNumber=Numéro de station
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css (from rev 88, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2012-12-19 10:16:51 UTC (rev 89)
@@ -0,0 +1,528 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+JToolBar {
+ floatable: false;
+}
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+BeanDoubleList {
+ bean: {model};
+}
+
+JList {
+ selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
+ model: {new DefaultListModel()};
+}
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+SimpleTimeEditor {
+ bean: {model};
+}
+
+#stationNumberLabel {
+ text: "tutti.label.fishingOperation.stationNumber";
+ labelFor: {stationNumberField};
+}
+
+#stationNumberField {
+ text: {model.getStationNumber()};
+}
+
+#fishingOperationNumberLabel {
+ text: "tutti.label.fishingOperation.fishingOperationNumber";
+ labelFor: {fishingOperationNumberField};
+}
+
+#fishingOperationNumberField {
+ property: "fishingOperationNumber";
+ model: {model.getFishingOperationNumber()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#dateLabel {
+ text: "tutti.label.fishingOperation.date";
+ labelFor: {dateField};
+}
+
+#dateField {
+ date: {model.getDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#strataLabel {
+ text: "tutti.label.fishingOperation.strata";
+ labelFor: {strataComboBox};
+}
+
+#strataComboBox {
+ property: "strata";
+ selectedItem: {model.getStrata()};
+}
+
+#subStrataLabel {
+ text: "tutti.label.fishingOperation.subStrata";
+ labelFor: {subStrataComboBox};
+}
+
+#subStrataComboBox {
+ property: "subStrata";
+ selectedItem: {model.getSubStrata()};
+}
+
+#localiteLabel {
+ text: "tutti.label.fishingOperation.localite";
+ labelFor: {localiteComboBox};
+}
+
+#localiteComboBox {
+ property: "localite";
+ selectedItem: {model.getLocalite()};
+}
+
+#gearLongitudeLabel {
+ text: "tutti.label.fishingOperation.gearLongitude";
+}
+
+#gearLatitudeLabel {
+ text: "tutti.label.fishingOperation.gearLatitude";
+}
+
+#gearDateLabel {
+ text: "tutti.label.fishingOperation.gearDate";
+}
+
+#gearTimeLabel {
+ text: "tutti.label.fishingOperation.gearTime";
+}
+
+#gearShootingStartLabel {
+ text: "tutti.label.fishingOperation.gearShootingStart";
+}
+
+#gearShootingEndLabel {
+ text: "tutti.label.fishingOperation.gearShootingEnd";
+}
+
+#gearShootingStartLongitudeField {
+ text: {getStringValue(model.getGearShootingStartLongitude())};
+}
+
+#gearShootingStartLatitudeField {
+ text: {getStringValue(model.getGearShootingStartLatitude())};
+}
+
+#gearShootingStartDateField {
+ date: {model.getGearShootingStartDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#gearShootingStartTimeField {
+ property: "gearShootingStartDate";
+ date: {model.getGearShootingStartDate()};
+}
+
+#gearShootingEndLongitudeField {
+ text: {getStringValue(model.getGearShootingEndLongitude())};
+}
+
+#gearShootingEndLatitudeField {
+ text: {getStringValue(model.getGearShootingEndLatitude())};
+}
+
+#gearShootingEndDateField {
+ date: {model.getGearShootingEndDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#gearShootingEndTimeField {
+ property: "gearShootingEndDate";
+ date: {model.getGearShootingEndDate()};
+}
+
+#fishingOperationValidPanel {
+ floatable: false;
+ borderPainted: false;
+ opaque: false;
+}
+
+#resetValidStateButton {
+ actionIcon: "reset";
+ text: "tutti.action.reset.fishingOperationValidState";
+}
+
+#fishingOperationValidRadio {
+ text: "tutti.label.fishingOperation.fishingOperationValid";
+ selected: {model.getFishingOperationValid() == Boolean.TRUE};
+ buttonGroup: "fishingOperationValid";
+}
+
+#fishingOperationInvalidRadio {
+ text: "tutti.label.fishingOperation.fishingOperationInvalid";
+ selected: {model.getFishingOperationValid() == Boolean.FALSE};
+ buttonGroup: "fishingOperationValid";
+}
+#fishingOperationResetRadio {
+ selected: {model.getFishingOperationValid() == null};
+ buttonGroup: "fishingOperationValid";
+}
+
+#fishingOperationRectiligneCheckBox {
+ text: "tutti.label.fishingOperation.fishingOperationRectiligne";
+ selected: {model.isFishingOperationRectiligne()};
+}
+
+#distanceChaluteeLabel {
+ text: "tutti.label.fishingOperation.distanceChalutee";
+ labelFor: {distanceChaluteeField};
+}
+
+#distanceChaluteeField {
+ property: "distanceChalutee";
+ model: {model.getDistanceChalutee()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+ enabled: {!model.isFishingOperationRectiligne()};
+}
+
+#beaufortScaleLabel {
+ text: "tutti.label.fishingOperation.beaufortScale";
+ labelFor: {beaufortScaleComboBox};
+}
+
+#beaufortScaleComboBox {
+ property: "beaufortScale";
+ selectedItem: {model.getBeaufortScale()};
+}
+
+#windDirectionLabel {
+ text: "tutti.label.fishingOperation.windDirection";
+ labelFor: {windDirectionField};
+}
+
+#windDirectionField {
+ property: "windDirection";
+ model: {model.getWindDirection()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#seaStateLabel {
+ text: "tutti.label.fishingOperation.seaState";
+ labelFor: {seaStateComboBox};
+}
+
+#seaStateComboBox {
+ property: "seaState";
+ selectedItem: {model.getSeaState()};
+}
+
+#ouvertureHorizontaleLabel {
+ text: "tutti.label.fishingOperation.ouvertureHorizontale";
+ labelFor: {ouvertureHorizontaleField};
+}
+
+#ouvertureHorizontaleVerticaleLabel {
+ text: "tutti.label.fishingOperation.ouvertureHorizontaleVerticale";
+}
+
+#ouvertureHorizontaleField {
+ property: "ouvertureHorizontale";
+ model: {model.getOuvertureHorizontale()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#ouvertureVerticaleLabel {
+ text: "tutti.label.fishingOperation.ouvertureVerticale";
+ labelFor: {ouvertureVerticaleField};
+}
+
+#ouvertureVerticaleField {
+ property: "ouvertureVerticale";
+ model: {model.getOuvertureVerticale()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#geometrieMesureeCheckBox {
+ text: "tutti.label.fishingOperation.geometrieMesuree";
+ selected: {model.isGeometrieMesuree()};
+}
+
+#longueurFunesLabel {
+ text: "tutti.label.fishingOperation.longueurFunes";
+ labelFor: {longueurFunesField};
+}
+
+#longueurFunesBrasLabel {
+ text: "tutti.label.fishingOperation.longueurFunesBras";
+}
+
+#longueurFunesField {
+ property: "longueurFunes";
+ model: {model.getLongueurFunes()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#longueurBrasLabel {
+ text: "tutti.label.fishingOperation.longueurBras";
+ labelFor: {longueurBrasField};
+}
+
+#longueurBrasField {
+ property: "longueurBras";
+ model: {model.getLongueurBras()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#systemeFermetureCulCheckBox {
+ text: "tutti.label.fishingOperation.systemeFermetureCul";
+ selected: {model.isSystemeFermetureCul()};
+}
+
+#dureeLabel {
+ text: "tutti.label.fishingOperation.duree";
+ labelFor: {dureeField};
+}
+
+#dureeField {
+ text: {getStringValue(model.getDuree())};
+ enabled: false;
+}
+
+#saisisseurList {
+ beanType: {Person.class};
+ property: "saisisseur";
+ border: {BorderFactory.createTitledBorder(_("tutti.label.list.saisisseur"))};
+}
+
+#commentPane {
+ columnHeaderView: {new JLabel(_("tutti.label.comment"))};
+ minimumSize: {new Dimension(10,50)};
+}
+
+#commentField {
+ text: {model.getComment()};
+}
+
+#gearShootingStartDepthLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartDepth";
+ labelFor: {gearShootingStartDepthField};
+}
+
+#gearShootingStartDepthField {
+ property: "gearShootingStartDepth";
+ model: {model.getGearShootingStartDepth()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndDepthLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndDepth";
+ labelFor: {gearShootingEndDepthField};
+}
+
+#gearShootingEndDepthField {
+ property: "gearShootingEndDepth";
+ model: {model.getGearShootingEndDepth()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartSurfaceTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartSurfaceTemperature";
+ labelFor: {gearShootingStartSurfaceTemperatureField};
+}
+
+#gearShootingStartSurfaceTemperatureField {
+ property: "gearShootingStartSurfaceTemperature";
+ model: {model.getGearShootingStartSurfaceTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndSurfaceTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndSurfaceTemperature";
+ labelFor: {gearShootingEndSurfaceTemperatureField};
+}
+
+#gearShootingEndSurfaceTemperatureField {
+ property: "gearShootingEndSurfaceTemperature";
+ model: {model.getGearShootingEndSurfaceTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartBottomTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartBottomTemperature";
+ labelFor: {gearShootingStartBottomTemperatureField};
+}
+
+#gearShootingStartBottomTemperatureField {
+ property: "gearShootingStartBottomTemperature";
+ model: {model.getGearShootingStartBottomTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndBottomTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndBottomTemperature";
+ labelFor: {gearShootingEndBottomTemperatureField};
+}
+
+#gearShootingEndBottomTemperatureField {
+ property: "gearShootingEndBottomTemperature";
+ model: {model.getGearShootingEndBottomTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#averageBottomTemperatureLabel {
+ text: "tutti.label.fishingOperation.averageBottomTemperature";
+ labelFor: {averageBottomTemperatureField};
+}
+
+#averageBottomTemperatureField {
+ property: "averageBottomTemperature";
+ model: {model.getAverageBottomTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartSurfaceSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartSurfaceSalinity";
+ labelFor: {gearShootingStartSurfaceSalinityField};
+}
+
+#gearShootingStartSurfaceSalinityField {
+ property: "gearShootingStartSurfaceSalinity";
+ model: {model.getGearShootingStartSurfaceSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndSurfaceSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndSurfaceSalinity";
+ labelFor: {gearShootingEndSurfaceSalinityField};
+}
+
+#gearShootingEndSurfaceSalinityField {
+ property: "gearShootingEndSurfaceSalinity";
+ model: {model.getGearShootingEndSurfaceSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartBottomSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartBottomSalinity";
+ labelFor: {gearShootingStartBottomSalinityField};
+}
+
+#gearShootingStartBottomSalinityField {
+ property: "gearShootingStartBottomSalinity";
+ model: {model.getGearShootingStartBottomSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndBottomSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndBottomSalinity";
+ labelFor: {gearShootingEndBottomSalinityField};
+}
+
+#gearShootingEndBottomSalinityField {
+ property: "gearShootingEndBottomSalinity";
+ model: {model.getGearShootingEndBottomSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#averageBottomSalinityLabel {
+ text: "tutti.label.fishingOperation.averageBottomSalinity";
+ labelFor: {averageBottomSalinityField};
+}
+
+#averageBottomSalinityField {
+ property: "averageBottomSalinity";
+ model: {model.getAverageBottomSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#noTraitPane {
+ text: "tutti.label.no.fishingOperation.selected";
+ horizontalAlignment: {JLabel.CENTER};
+}
+
+#saveButton {
+ actionIcon: "save";
+ text: "tutti.action.save";
+ enabled: {model.isModify() && model.isValid()};
+}
+
+#cancelButton {
+ actionIcon: "cancel";
+ text: "tutti.action.cancel";
+ enabled: {model.isModify()};
+}
+
+#importPupitriButton {
+ actionIcon: "pupitri-import";
+ text: "tutti.action.pupitri-import";
+}
+
+#importCasinoButton {
+ actionIcon: "casino-import";
+ text: "tutti.action.casino-import";
+}
+
+#messagePanel {
+ border: {BorderFactory.createTitledBorder("Messages")};
+ height: 200;
+ width: 500;
+}
+
+#errorTable {
+ rowSelectionAllowed: true;
+ autoCreateRowSorter: true;
+ autoResizeMode: 2;
+ cellSelectionEnabled: false;
+ selectionMode: 0;
+ model: {errorTableModel};
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx (from rev 88, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2012-12-19 10:16:51 UTC (rev 89)
@@ -0,0 +1,558 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a 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<EditFishingOperationUIModel, EditFishingOperationUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
+ fr.ifremer.tutti.persistence.entities.referential.SeaState
+ fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+ fr.ifremer.tutti.persistence.entities.referential.Person
+
+ fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor
+ fr.ifremer.tutti.ui.swing.content.operation.fishing.EnvironmentTabUI
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.swing.editor.bean.BeanListHeader
+ jaxx.runtime.swing.editor.bean.BeanDoubleList
+ jaxx.runtime.swing.editor.NumberEditor
+ jaxx.runtime.swing.editor.TimeEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ org.jdesktop.swingx.JXDatePicker
+ org.jdesktop.swingx.JXTable
+
+ java.awt.Dimension
+
+ javax.swing.DefaultListModel
+ javax.swing.ListSelectionModel
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+ </import>
+
+ <script><![CDATA[
+
+public EditFishingOperationUI(FishingOperationsUI parentUI) {
+ EditFishingOperationUIHandler handler = new EditFishingOperationUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <EditFishingOperationUIHandler id='handler'
+ initializer='getContextValue(EditFishingOperationUIHandler.class)'/>
+
+ <EditFishingOperationUIModel id='model'
+ initializer='getContextValue(EditFishingOperationUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='stationNumber' component='stationNumberField'/>
+ <field name='fishingOperationNumber'
+ component='fishingOperationNumberField'/>
+ <field name='date' component='dateField'/>
+ <field name='comment' component='commentField'/>
+ <field name='saisisseur' component='saisisseurList'/>
+ </BeanValidator>
+
+ <JPanel id='fishingOperationPane' constraints='BorderLayout.CENTER'
+ layout='{new BorderLayout()}'>
+
+ <JTabbedPane id='fishingOperationTabPane' constraints='BorderLayout.CENTER'>
+ <tab id='traitGeneralTab'
+ title='tutti.label.tab.fishingOperation.general'>
+ <Table fill='both' id='generalForm'>
+
+ <!-- Numero station / Numéro trait / Date -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='stationNumberLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <NumberEditor id='stationNumberField' constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='fishingOperationNumberLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <NumberEditor id='fishingOperationNumberField'
+ constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='dateLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JXDatePicker id='dateField'
+ onActionPerformed='handler.setDate(event, "date")'/>
+ </cell>
+ </row>
+
+ <!-- Strate d'association / Sous Strate / Localité -->
+ <row>
+ <cell>
+ <JLabel id='strataLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <BeanComboBox id='strataComboBox' constructorParams='this'
+ genericType='FishingOperationLocation'/>
+ </cell>
+ <cell>
+ <JLabel id='subStrataLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <BeanComboBox id='subStrataComboBox' constructorParams='this'
+ genericType='FishingOperationLocation'/>
+ </cell>
+ <cell>
+ <JLabel id='localiteLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <BeanComboBox id='localiteComboBox' constructorParams='this'
+ genericType='FishingOperationLocation'/>
+ </cell>
+ </row>
+
+ <!-- début de traine long-lat-date-heure
+ fin de traine long-lat-date-heure -->
+ <row>
+ <cell columns='6'>
+ <JPanel layout="{new BorderLayout()}">
+ <Table id="gearCaracteristicsTable" fill="both" weightx='1'
+ constraints='BorderLayout.CENTER'>
+ <row>
+ <cell>
+ <JLabel/>
+ </cell>
+ <cell>
+ <JLabel id='gearLatitudeLabel'/>
+ </cell>
+ <cell>
+ <JLabel id='gearLongitudeLabel'/>
+ </cell>
+ <cell>
+ <JLabel id='gearDateLabel'/>
+ </cell>
+ <cell>
+ <JLabel id='gearTimeLabel'/>
+ </cell>
+ </row>
+
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingStartLatitudeLabel'
+ onKeyReleased='handler.setGearShootingStartLatitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingStartLongitudeField'
+ onKeyReleased='handler.setGearShootingStartLongitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JXDatePicker id='gearShootingStartDateField'
+ onActionPerformed='handler.setDate(event, "gearShootingStartDate")'/>
+ </cell>
+ <cell>
+ <SimpleTimeEditor id='gearShootingStartTimeField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingEndLatitudeLabel'
+ onKeyReleased='handler.setGearShootingEndLatitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingEndLongitudeField'
+ onKeyReleased='handler.setGearShootingEndLongitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JXDatePicker id='gearShootingEndDateField'
+ onActionPerformed='handler.setDate(event, "gearShootingEndDate")'/>
+ </cell>
+ <cell>
+ <SimpleTimeEditor id='gearShootingEndTimeField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- Fishing operation valid / invalid-->
+ <row>
+ <cell>
+ <JToolBar id='fishingOperationValidPanel'
+ layout='{new BorderLayout()}'>
+ <JButton id='resetValidStateButton'
+ constraints='BorderLayout.WEST'
+ onActionPerformed="model.setFishingOperationValid(null)"/>
+ <JRadioButton id='fishingOperationResetRadio'
+ constraints='BorderLayout.EAST'/>
+ </JToolBar>
+ </cell>
+ <cell>
+ <HBox>
+ <JRadioButton id='fishingOperationValidRadio'
+ onActionPerformed='model.setFishingOperationValid(Boolean.TRUE)'/>
+ <JRadioButton id='fishingOperationInvalidRadio'
+ onActionPerformed='model.setFishingOperationValid(Boolean.FALSE)'/>
+ </HBox>
+ </cell>
+ <cell columns="4">
+ <JPanel/>
+ </cell>
+ </row>
+
+ <!-- FishingOperation rectiligne / distance chalutee / durée -->
+ <row>
+ <cell>
+ <JCheckBox id='fishingOperationRectiligneCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "fishingOperationRectiligne")'/>
+ </cell>
+ <cell columns="3">
+ <JPanel layout="{new BorderLayout()}">
+ <JLabel id='distanceChaluteeLabel'
+ constraints='BorderLayout.WEST'/>
+ <NumberEditor id='distanceChaluteeField'
+ constraints='BorderLayout.CENTER'
+ constructorParams='this'/>
+ </JPanel>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='dureeLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <JTextField id='dureeField'/>
+ </cell>
+ </row>
+
+ <!-- Actions d'import -->
+ <row>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='importPupitriButton'
+ onActionPerformed='handler.importPupitri()'/>
+ <JButton id='importCasinoButton'
+ onActionPerformed='handler.importCasino()'/>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- Saisisseur -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <!-- <JScrollPane id='saisisseurPane'
+ columnHeaderView="{saisisseurHeader}"
+ onFocusGained='saisisseurList.requestFocus()'>
+ <JList id='saisisseurList'
+ onValueChanged='handler.selectListData(event, "saisisseur")'/>
+ <BeanListHeader id='saisisseurHeader' genericType='Person'/>
+ </JScrollPane>-->
+ <BeanDoubleList id='saisisseurList' genericType='Person'/>
+ </cell>
+ </row>
+
+ <!-- Commentaire -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JScrollPane id='commentPane'
+ onFocusGained='commentField.requestFocus()'>
+ <JTextArea id='commentField'
+ onKeyReleased='handler.setText(event, "comment")'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </tab>
+
+ <tab id='traitGearShootingTab'
+ title='tutti.label.tab.fishingOperation.gearShooting'>
+
+ <Table fill='both' id='gearShootingForm'>
+
+ <!-- GearShootingStart Depth -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartDepthLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartDepthField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEnd Depth -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndDepthLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndDepthField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Ouverture horizontale -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='ouvertureHorizontaleLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='ouvertureHorizontaleField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Ouverture verticale -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='ouvertureVerticaleLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='ouvertureVerticaleField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Longueur funes -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='longueurFunesLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='longueurFunesField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Longueur bras -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='longueurBrasLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='longueurBrasField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Système de fermeture du cul / Geometrie mesuree -->
+ <row>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JCheckBox id='systemeFermetureCulCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "systemeFermetureCul")'/>
+ <JCheckBox id='geometrieMesureeCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+ </tab>
+
+ <tab id='environmentTab'
+ title='tutti.label.tab.fishingOperation.environment'>
+
+ <EnvironmentTabUI id='environmentTabContent' constructorParams='this'/>
+<!-- <Table fill='both' id='environmentForm'>
+
+ Beaufort scale
+ <row>
+ <cell anchor='west'>
+ <JLabel id='beaufortScaleLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
+ genericType='BeaufortScale'/>
+ </cell>
+ </row>
+
+ Wind direction
+ <row>
+ <cell anchor='west'>
+ <JLabel id='windDirectionLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='windDirectionField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ Sea state
+ <row>
+ <cell anchor='west'>
+ <JLabel id='seaStateLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <BeanComboBox id='seaStateComboBox' constructorParams='this'
+ genericType='SeaState'/>
+ </cell>
+ </row>
+ </Table>-->
+ </tab>
+
+ <tab id='traitHydrologyTabContent'
+ title='tutti.label.tab.fishingOperation.hydrology'>
+
+ <Table fill='both' id='hydrologyForm'>
+
+ <!-- GearShootingStartSurfaceTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartSurfaceTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartSurfaceTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndSurfaceTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndSurfaceTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndSurfaceTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStartBottomTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartBottomTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartBottomTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndBottomTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndBottomTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndBottomTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- AverageBottomTemperature -->
+ <row>
+ <cell>
+ <JLabel id='averageBottomTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='averageBottomTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStartSurfaceSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartSurfaceSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartSurfaceSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndSurfaceSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndSurfaceSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndSurfaceSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStartBottomSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartBottomSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartBottomSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndBottomSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndBottomSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndBottomSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- AverageBottomSalinity -->
+ <row>
+ <cell>
+ <JLabel id='averageBottomSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='averageBottomSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ </Table>
+ </tab>
+ </JTabbedPane>
+
+ <!-- Actions -->
+ <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.SOUTH'>
+ <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.CENTER'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ </JPanel>
+ </JPanel>
+
+ </JPanel>
+
+ <JLabel id='noTraitPane'/>
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java (from rev 88, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-19 10:16:51 UTC (rev 89)
@@ -0,0 +1,227 @@
+package fr.ifremer.tutti.ui.swing.content.operation;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import java.awt.BorderLayout;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+/**
+ * Handler for UI {@link EditFishingOperationUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditFishingOperationUIHandler extends AbstractTuttiUIHandler<EditFishingOperationUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EditFishingOperationUIHandler.class);
+
+ private final EditFishingOperationUI ui;
+
+ private final FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public EditFishingOperationUIHandler(FishingOperationsUI parentUi, EditFishingOperationUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ EditFishingOperationUIModel model = new EditFishingOperationUIModel();
+ model.addPropertyChangeListener(EditFishingOperationUIModel.PROPERTY_EMPTY, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ JPanel form = ui.getFishingOperationPane();
+ JLabel noContentPane = ui.getNoTraitPane();
+
+ Boolean empty = (Boolean) evt.getNewValue();
+ ui.remove(form);
+ ui.remove(noContentPane);
+ if (empty) {
+ ui.add(noContentPane, BorderLayout.CENTER);
+ } else {
+ ui.add(form, BorderLayout.CENTER);
+ }
+ ui.repaint();
+ }
+ });
+
+ listModelIsModify(model);
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ ui.getFishingOperationValidPanel().remove(
+ ui.getFishingOperationResetRadio());
+
+ EditFishingOperationUIModel model = ui.getModel();
+
+ initUI(ui);
+
+ initBeanList(ui.getSaisisseurList(),
+ persistenceService.getAllPerson(),
+ model.getSaisisseur());
+
+// initBeanComboBox(ui.getBeaufortScaleComboBox(),
+// persistenceService.getAllBeaufortScale(),
+// model.getBeaufortScale());
+//
+// initBeanComboBox(ui.getStrataComboBox(),
+// persistenceService.getAllStrata(),
+// model.getStrata());
+//
+// initBeanComboBox(ui.getSeaStateComboBox(),
+// persistenceService.getAllSeaState(),
+// model.getSeaState());
+
+ model.setEmpty(true);
+
+ listenValidatorValid(ui.getValidator(), getModel());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected EditFishingOperationUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ boolean empty = bean == null;
+
+ EditFishingOperationUIModel model = getModel();
+
+ if (empty) {
+
+ model.fromBean(new FishingOperation());
+ } else {
+
+ model.fromBean(bean);
+ }
+
+ // update saisissuer selection
+ List<Person> saisisseur = model.getSaisisseur();
+ ui.getSaisisseurList().getModel().setSelected(saisisseur);
+
+ // update model empty property
+ model.setEmpty(empty);
+
+ // if new fishingOperation can already cancel his creation
+ model.setModify(!empty && model.isCreate());
+
+ ui.getEnvironmentTabContent().getHandler().afterInitUI();
+ }
+
+ public void cancel() {
+
+ String id = getModel().getId();
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition for fishingOperation: " + id);
+ }
+ boolean newBean = StringUtils.isBlank(id);
+
+ if (newBean) {
+
+ // cancel to create a new fishingOperation
+ parentUi.getHandler().selectFishingOperation(null);
+
+ } else {
+
+ // reselect in ui the fishingOperation
+ FishingOperation selectedFishingOperation = parentUi.getModel().getSelectedFishingOperation();
+ parentUi.getHandler().selectFishingOperation(selectedFishingOperation);
+ }
+ }
+
+ public void save() {
+
+ // get fishingOperation to save
+ FishingOperation toSave = getModel().toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("Save edition for fishingOperation: " + toSave.getId());
+ }
+
+ // keep selected tab (to resotre it after save)
+ int selectedIndex = ui.getFishingOperationTabPane().getSelectedIndex();
+
+ // persist current fishingOperation
+ parentUi.getHandler().saveFishingOperation(toSave);
+
+ // reselect current tab
+ ui.getFishingOperationTabPane().setSelectedIndex(selectedIndex);
+
+ getModel().setModify(false);
+ }
+
+ public void importPupitri() {
+ //TODO
+ }
+
+ public void importCasino() {
+ //TODO
+ }
+
+ public void setGearShootingStartLatitude(String text) {
+ getModel().setGearShootingStartLatitude(Float.valueOf(text));
+ }
+
+ public void setGearShootingStartLongitude(String text) {
+ getModel().setGearShootingStartLongitude(Float.valueOf(text));
+ }
+
+ public void setGearShootingEndLatitude(String text) {
+ getModel().setGearShootingEndLatitude(Float.valueOf(text));
+ }
+
+ public void setGearShootingEndLongitude(String text) {
+ getModel().setGearShootingEndLongitude(Float.valueOf(text));
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java (from rev 88, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-19 10:16:51 UTC (rev 89)
@@ -0,0 +1,633 @@
+package fr.ifremer.tutti.ui.swing.content.operation;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.SeaState;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Model for UI {@link EditFishingOperationUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditFishingOperationUIModel extends AbstractTuttiBeanUIModel<FishingOperation, EditFishingOperationUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_EMPTY = "empty";
+
+ public static final String PROPERTY_STATION_NUMBER = "stationNumber";
+
+ public static final String PROPERTY_FISHING_OPERATION_NUMBER = "fishingOperationNumber";
+
+ public static final String PROPERTY_DATE = "date";
+
+ public static final String PROPERTY_STRATA = "strata";
+
+ public static final String PROPERTY_SUB_STRATA = "subStrata";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE = "gearShootingStartLatitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE = "gearShootingStartLongitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_DATE = "gearShootingStartDate";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_DEPTH = "gearShootingStartDepth";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = "gearShootingEndLatitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = "gearShootingEndLongitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_DATE = "gearShootingEndDate";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth";
+
+ public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale";
+
+ public static final String PROPERTY_WIND_DIRECTION = "windDirection";
+
+ public static final String PROPERTY_SEA_STATE = "seaState";
+
+ public static final String PROPERTY_OUVERTURE_HORIZONTALE = "ouvertureHorizontale";
+
+ public static final String PROPERTY_OUVERTURE_VERTICALE = "ouvertureVerticale";
+
+ public static final String PROPERTY_GEOMETRIE_MESUREE = "geometrieMesuree";
+
+ public static final String PROPERTY_LONGUEUR_FUNES = "longueurFunes";
+
+ public static final String PROPERTY_LONGUEUR_BRAS = "longueurBras";
+
+ public static final String PROPERTY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul";
+
+ public static final String PROPERTY_FISHING_OPERATION_RECTILIGNE = "fishingOperationRectiligne";
+
+ public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee";
+
+ public static final String PROPERTY_DUREE = "duree";
+
+ public static final String PROPERTY_FISHING_OPERATION_VALID = "fishingOperationValid";
+
+ public static final String PROPERTY_LOCALITE = "localite";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_SAISISSEUR = "saisisseur";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE = "gearShootingStartSurfaceTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE = "gearShootingEndSurfaceTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE = "gearShootingStartBottomTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE = "gearShootingEndBottomTemperature";
+
+ public static final String PROPERTY_AVERAGE_BOTTOM_TEMPERATURE = "averageBottomTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY = "gearShootingStartSurfaceSalinity";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY = "gearShootingEndSurfaceSalinity";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY = "gearShootingStartBottomSalinity";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY = "gearShootingEndBottomSalinity";
+
+ public static final String PROPERTY_AVERAGE_BOTTOM_SALINITY = "averageBottomSalinity";
+
+ protected boolean empty;
+
+ protected Cruise cruise;
+
+ protected Integer stationNumber;
+
+ protected Integer fishingOperationNumber;
+
+ protected Date date;
+
+ protected FishingOperationLocation strata;
+
+ protected FishingOperationLocation subStrata;
+
+ protected Float gearShootingStartLatitude;
+
+ protected Float gearShootingStartLongitude;
+
+ protected Date gearShootingStartDate;
+
+ protected Integer gearShootingStartTime;
+
+ protected Float gearShootingStartDepth;
+
+ protected Float gearShootingEndLatitude;
+
+ protected Float gearShootingEndLongitude;
+
+ protected Date gearShootingEndDate;
+
+ protected Integer gearShootingEndTime;
+
+ protected Float gearShootingEndDepth;
+
+ protected BeaufortScale beaufortScale;
+
+ protected Integer windDirection;
+
+ protected SeaState seaState;
+
+ protected Float ouvertureHorizontale;
+
+ protected Float ouvertureVerticale;
+
+ protected boolean geometrieMesuree;
+
+ protected Float longueurFunes;
+
+ protected Float longueurBras;
+
+ protected boolean systemeFermetureCul;
+
+ protected boolean fishingOperationRectiligne;
+
+ protected Float distanceChalutee;
+
+ protected Float duree;
+
+ protected Boolean fishingOperationValid;
+
+ protected FishingOperationLocation localite;
+
+ protected String comment;
+
+ protected List<Person> saisisseur;
+
+ protected Float gearShootingStartSurfaceTemperature;
+
+ protected Float gearShootingEndSurfaceTemperature;
+
+ protected Float gearShootingStartBottomTemperature;
+
+ protected Float gearShootingEndBottomTemperature;
+
+ protected Float averageBottomTemperature;
+
+ protected Float gearShootingStartSurfaceSalinity;
+
+ protected Float gearShootingEndSurfaceSalinity;
+
+ protected Float gearShootingStartBottomSalinity;
+
+ protected Float gearShootingEndBottomSalinity;
+
+ protected Float averageBottomSalinity;
+
+ protected static Binder<EditFishingOperationUIModel, FishingOperation> toBeanBinder =
+ BinderFactory.newBinder(EditFishingOperationUIModel.class,
+ FishingOperation.class);
+
+ protected static Binder<FishingOperation, EditFishingOperationUIModel> fromBeanBinder =
+ BinderFactory.newBinder(FishingOperation.class, EditFishingOperationUIModel.class);
+
+ public EditFishingOperationUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public boolean isEmpty() {
+ return empty;
+ }
+
+ public void setEmpty(boolean empty) {
+ Object oldValue = isEmpty();
+ this.empty = empty;
+ firePropertyChange(PROPERTY_EMPTY, oldValue, empty);
+ }
+
+ public Cruise getCruise() {
+ return cruise;
+ }
+
+ public void setCruise(Cruise cruise) {
+ this.cruise = cruise;
+ }
+
+ public Integer getStationNumber() {
+ return stationNumber;
+ }
+
+ public void setStationNumber(Integer stationNumber) {
+ Object oldValue = getStationNumber();
+ this.stationNumber = stationNumber;
+ firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber);
+ }
+
+ public Integer getFishingOperationNumber() {
+ return fishingOperationNumber;
+ }
+
+ public void setFishingOperationNumber(Integer fishingOperationNumber) {
+ Object oldValue = getFishingOperationNumber();
+ this.fishingOperationNumber = fishingOperationNumber;
+ firePropertyChange(PROPERTY_FISHING_OPERATION_NUMBER, oldValue, fishingOperationNumber);
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ Object oldValue = getDate();
+ this.date = date;
+ firePropertyChange(PROPERTY_DATE, oldValue, date);
+ }
+
+ public FishingOperationLocation getStrata() {
+ return strata;
+ }
+
+ public void setStrata(FishingOperationLocation strata) {
+ Object oldValue = getStrata();
+ this.strata = strata;
+ firePropertyChange(PROPERTY_STRATA, oldValue, strata);
+ }
+
+ public FishingOperationLocation getSubStrata() {
+ return subStrata;
+ }
+
+ public void setSubStrata(FishingOperationLocation subStrata) {
+ Object oldValue = getSubStrata();
+ this.subStrata = subStrata;
+ firePropertyChange(PROPERTY_SUB_STRATA, oldValue, subStrata);
+ }
+
+ public Float getGearShootingStartLatitude() {
+ return gearShootingStartLatitude;
+ }
+
+ public void setGearShootingStartLatitude(Float gearShootingStartLatitude) {
+ Object oldValue = getGearShootingStartLatitude();
+ this.gearShootingStartLatitude = gearShootingStartLatitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LATITUDE, oldValue, gearShootingStartLatitude);
+ }
+
+ public Float getGearShootingStartLongitude() {
+ return gearShootingStartLongitude;
+ }
+
+ public void setGearShootingStartLongitude(Float gearShootingStartLongitude) {
+ Object oldValue = getGearShootingStartLongitude();
+ this.gearShootingStartLongitude = gearShootingStartLongitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE, oldValue, gearShootingStartLongitude);
+ }
+
+ public Date getGearShootingStartDate() {
+ return gearShootingStartDate;
+ }
+
+ public void setGearShootingStartDate(Date gearShootingStartDate) {
+ Object oldValue = getGearShootingStartDate();
+ this.gearShootingStartDate = gearShootingStartDate;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DATE, oldValue, gearShootingStartDate);
+ }
+
+ public Float getGearShootingStartDepth() {
+ return gearShootingStartDepth;
+ }
+
+ public void setGearShootingStartDepth(Float gearShootingStartDepth) {
+ Object oldValue = getGearShootingStartDepth();
+ this.gearShootingStartDepth = gearShootingStartDepth;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DEPTH, oldValue, gearShootingStartDepth);
+ }
+
+ public Float getGearShootingEndLatitude() {
+ return gearShootingEndLatitude;
+ }
+
+ public void setGearShootingEndLatitude(Float gearShootingEndLatitude) {
+ Object oldValue = getGearShootingEndLatitude();
+ this.gearShootingEndLatitude = gearShootingEndLatitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE, oldValue, gearShootingEndLatitude);
+ }
+
+ public Float getGearShootingEndLongitude() {
+ return gearShootingEndLongitude;
+ }
+
+ public void setGearShootingEndLongitude(Float gearShootingEndLongitude) {
+ Object oldValue = getGearShootingEndLongitude();
+ this.gearShootingEndLongitude = gearShootingEndLongitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE, oldValue, gearShootingEndLongitude);
+ }
+
+ public Date getGearShootingEndDate() {
+ return gearShootingEndDate;
+ }
+
+ public void setGearShootingEndDate(Date gearShootingEndDate) {
+ Object oldValue = getGearShootingEndDate();
+ this.gearShootingEndDate = gearShootingEndDate;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, gearShootingEndDate);
+ }
+
+ public Float getGearShootingEndDepth() {
+ return gearShootingEndDepth;
+ }
+
+ public void setGearShootingEndDepth(Float gearShootingEndDepth) {
+ Object oldValue = getGearShootingEndDepth();
+ this.gearShootingEndDepth = gearShootingEndDepth;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth);
+ }
+
+ public BeaufortScale getBeaufortScale() {
+ return beaufortScale;
+ }
+
+ public void setBeaufortScale(BeaufortScale beaufortScale) {
+ Object oldValue = getBeaufortScale();
+ this.beaufortScale = beaufortScale;
+ firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale);
+ }
+
+ public Integer getWindDirection() {
+ return windDirection;
+ }
+
+ public void setWindDirection(Integer windDirection) {
+ Object oldValue = getWindDirection();
+ this.windDirection = windDirection;
+ firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection);
+ }
+
+ public SeaState getSeaState() {
+ return seaState;
+ }
+
+ public void setSeaState(SeaState seaState) {
+ Object oldValue = getSeaState();
+ this.seaState = seaState;
+ firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState);
+ }
+
+ public Float getOuvertureHorizontale() {
+ return ouvertureHorizontale;
+ }
+
+ public void setOuvertureHorizontale(Float ouvertureHorizontale) {
+ Object oldValue = getOuvertureHorizontale();
+ this.ouvertureHorizontale = ouvertureHorizontale;
+ firePropertyChange(PROPERTY_OUVERTURE_HORIZONTALE, oldValue, ouvertureHorizontale);
+ }
+
+ public Float getOuvertureVerticale() {
+ return ouvertureVerticale;
+ }
+
+ public void setOuvertureVerticale(Float ouvertureVerticale) {
+ Object oldValue = getOuvertureVerticale();
+ this.ouvertureVerticale = ouvertureVerticale;
+ firePropertyChange(PROPERTY_OUVERTURE_VERTICALE, oldValue, ouvertureVerticale);
+ }
+
+ public boolean isGeometrieMesuree() {
+ return geometrieMesuree;
+ }
+
+ public void setGeometrieMesuree(boolean geometrieMesuree) {
+ Object oldValue = isGeometrieMesuree();
+ this.geometrieMesuree = geometrieMesuree;
+ firePropertyChange(PROPERTY_GEOMETRIE_MESUREE, oldValue, geometrieMesuree);
+ }
+
+ public Float getLongueurFunes() {
+ return longueurFunes;
+ }
+
+ public void setLongueurFunes(Float longueurFunes) {
+ Object oldValue = getLongueurFunes();
+ this.longueurFunes = longueurFunes;
+ firePropertyChange(PROPERTY_LONGUEUR_FUNES, oldValue, longueurFunes);
+ }
+
+ public Float getLongueurBras() {
+ return longueurBras;
+ }
+
+ public void setLongueurBras(Float longueurBras) {
+ Object oldValue = getLongueurBras();
+ this.longueurBras = longueurBras;
+ firePropertyChange(PROPERTY_LONGUEUR_BRAS, oldValue, longueurBras);
+ }
+
+ public boolean isSystemeFermetureCul() {
+ return systemeFermetureCul;
+ }
+
+ public void setSystemeFermetureCul(boolean systemeFermetureCul) {
+ Object oldValue = isSystemeFermetureCul();
+ this.systemeFermetureCul = systemeFermetureCul;
+ firePropertyChange(PROPERTY_SYSTEME_FERMETURE_CUL, oldValue, systemeFermetureCul);
+ }
+
+ public boolean isFishingOperationRectiligne() {
+ return fishingOperationRectiligne;
+ }
+
+ public void setFishingOperationRectiligne(boolean fishingOperationRectiligne) {
+ Object oldValue = isFishingOperationRectiligne();
+ this.fishingOperationRectiligne = fishingOperationRectiligne;
+ firePropertyChange(PROPERTY_FISHING_OPERATION_RECTILIGNE, oldValue, fishingOperationRectiligne);
+ }
+
+ public Float getDistanceChalutee() {
+ return distanceChalutee;
+ }
+
+ public void setDistanceChalutee(Float distanceChalutee) {
+ Object oldValue = getDistanceChalutee();
+ this.distanceChalutee = distanceChalutee;
+ firePropertyChange(PROPERTY_DISTANCE_CHALUTEE, oldValue, distanceChalutee);
+ }
+
+ public Float getDuree() {
+ return duree;
+ }
+
+ public void setDuree(Float duree) {
+ Object oldValue = getDuree();
+ this.duree = duree;
+ firePropertyChange(PROPERTY_DUREE, oldValue, duree);
+ }
+
+ public Boolean getFishingOperationValid() {
+ return fishingOperationValid;
+ }
+
+ public void setFishingOperationValid(Boolean fishingOperationValid) {
+ Object oldValue = getFishingOperationValid();
+ this.fishingOperationValid = fishingOperationValid;
+ firePropertyChange(PROPERTY_FISHING_OPERATION_VALID, oldValue, fishingOperationValid);
+ }
+
+ public FishingOperationLocation getLocalite() {
+ return localite;
+ }
+
+ public void setLocalite(FishingOperationLocation localite) {
+ Object oldValue = getLocalite();
+ this.localite = localite;
+ firePropertyChange(PROPERTY_LOCALITE, oldValue, localite);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public List<Person> getSaisisseur() {
+ return saisisseur;
+ }
+
+ public void setSaisisseur(List<Person> saisisseur) {
+ this.saisisseur = saisisseur;
+ firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur);
+ }
+
+ public Float getGearShootingStartSurfaceTemperature() {
+ return gearShootingStartSurfaceTemperature;
+ }
+
+ public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) {
+ Object oldValue = getGearShootingStartSurfaceTemperature();
+ this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE, oldValue, gearShootingStartSurfaceTemperature);
+ }
+
+ public Float getGearShootingEndSurfaceTemperature() {
+ return gearShootingEndSurfaceTemperature;
+ }
+
+ public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) {
+ Object oldValue = getGearShootingEndSurfaceTemperature();
+ this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE, oldValue, gearShootingEndSurfaceTemperature);
+ }
+
+ public Float getGearShootingStartBottomTemperature() {
+ return gearShootingStartBottomTemperature;
+ }
+
+ public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) {
+ Object oldValue = getGearShootingStartBottomTemperature();
+ this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE, oldValue, gearShootingStartBottomTemperature);
+ }
+
+ public Float getGearShootingEndBottomTemperature() {
+ return gearShootingEndBottomTemperature;
+ }
+
+ public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) {
+ Object oldValue = getGearShootingEndBottomTemperature();
+ this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE, oldValue, gearShootingEndBottomTemperature);
+ }
+
+ public Float getAverageBottomTemperature() {
+ return averageBottomTemperature;
+ }
+
+ public void setAverageBottomTemperature(Float averageBottomTemperature) {
+ Object oldValue = getAverageBottomTemperature();
+ this.averageBottomTemperature = averageBottomTemperature;
+ firePropertyChange(PROPERTY_AVERAGE_BOTTOM_TEMPERATURE, oldValue, averageBottomTemperature);
+ }
+
+ public Float getGearShootingStartSurfaceSalinity() {
+ return gearShootingStartSurfaceSalinity;
+ }
+
+ public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) {
+ Object oldValue = getGearShootingStartSurfaceSalinity();
+ this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY, oldValue, gearShootingStartSurfaceSalinity);
+ }
+
+ public Float getGearShootingEndSurfaceSalinity() {
+ return gearShootingEndSurfaceSalinity;
+ }
+
+ public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) {
+ Object oldValue = getGearShootingEndSurfaceSalinity();
+ this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY, oldValue, gearShootingEndSurfaceSalinity);
+ }
+
+ public Float getGearShootingStartBottomSalinity() {
+ return gearShootingStartBottomSalinity;
+ }
+
+ public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) {
+ Object oldValue = getGearShootingStartBottomSalinity();
+ this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY, oldValue, gearShootingStartBottomSalinity);
+ }
+
+ public Float getGearShootingEndBottomSalinity() {
+ return gearShootingEndBottomSalinity;
+ }
+
+ public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) {
+ Object oldValue = getGearShootingEndBottomSalinity();
+ this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY, oldValue, gearShootingEndBottomSalinity);
+ }
+
+ public Float getAverageBottomSalinity() {
+ return averageBottomSalinity;
+ }
+
+ public void setAverageBottomSalinity(Float averageBottomSalinity) {
+ Object oldValue = getAverageBottomSalinity();
+ this.averageBottomSalinity = averageBottomSalinity;
+ firePropertyChange(PROPERTY_AVERAGE_BOTTOM_SALINITY, oldValue, averageBottomSalinity);
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.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/operation/FishingOperationTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css 2012-12-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css 2012-12-19 10:16:51 UTC (rev 89)
@@ -1,532 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-JToolBar {
- floatable: false;
-}
-
-BeanComboBox {
- showReset: true;
- i18nPrefix: "tutti.property.";
- bean: {model};
-}
-
-BeanDoubleList {
- bean: {model};
-}
-
-JList {
- selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
- model: {new DefaultListModel()};
-}
-
-NumberEditor {
- autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
- bean: {model};
- showReset: true;
-}
-
-SimpleTimeEditor {
- bean: {model};
-}
-
-#stationNumberLabel {
- text: "tutti.label.fishingOperation.stationNumber";
- labelFor: {stationNumberField};
-}
-
-#stationNumberField {
- property: "stationNumber";
- model: {model.getStationNumber()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#fishingOperationNumberLabel {
- text: "tutti.label.fishingOperation.fishingOperationNumber";
- labelFor: {fishingOperationNumberField};
-}
-
-#fishingOperationNumberField {
- property: "fishingOperationNumber";
- model: {model.getFishingOperationNumber()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#dateLabel {
- text: "tutti.label.fishingOperation.date";
- labelFor: {dateField};
-}
-
-#dateField {
- date: {model.getDate()};
- formats: {"dd/MM/yyyy"};
-}
-
-#strataLabel {
- text: "tutti.label.fishingOperation.strata";
- labelFor: {strataComboBox};
-}
-
-#strataComboBox {
- property: "strata";
- selectedItem: {model.getStrata()};
-}
-
-#subStrataLabel {
- text: "tutti.label.fishingOperation.subStrata";
- labelFor: {subStrataComboBox};
-}
-
-#subStrataComboBox {
- property: "subStrata";
- selectedItem: {model.getSubStrata()};
-}
-
-#localiteLabel {
- text: "tutti.label.fishingOperation.localite";
- labelFor: {localiteField};
-}
-
-#localiteField {
- text: {model.getLocalite()};
-}
-
-#gearLongitudeLabel {
- text: "tutti.label.fishingOperation.gearLongitude";
-}
-
-#gearLatitudeLabel {
- text: "tutti.label.fishingOperation.gearLatitude";
-}
-
-#gearDateLabel {
- text: "tutti.label.fishingOperation.gearDate";
-}
-
-#gearTimeLabel {
- text: "tutti.label.fishingOperation.gearTime";
-}
-
-#gearShootingStartLabel {
- text: "tutti.label.fishingOperation.gearShootingStart";
-}
-
-#gearShootingEndLabel {
- text: "tutti.label.fishingOperation.gearShootingEnd";
-}
-
-#gearShootingStartLongitudeField {
- text: {getStringValue(model.getGearShootingStartLongitude())};
-}
-
-#gearShootingStartLatitudeField {
- text: {getStringValue(model.getGearShootingStartLatitude())};
-}
-
-#gearShootingStartDateField {
- date: {model.getGearShootingStartDate()};
- formats: {"dd/MM/yyyy"};
-}
-
-#gearShootingStartTimeField {
- property: "gearShootingStartDate";
- date: {model.getGearShootingStartDate()};
-}
-
-#gearShootingEndLongitudeField {
- text: {getStringValue(model.getGearShootingEndLongitude())};
-}
-
-#gearShootingEndLatitudeField {
- text: {getStringValue(model.getGearShootingEndLatitude())};
-}
-
-#gearShootingEndDateField {
- date: {model.getGearShootingEndDate()};
- formats: {"dd/MM/yyyy"};
-}
-
-#gearShootingEndTimeField {
- property: "gearShootingEndDate";
- date: {model.getGearShootingEndDate()};
-}
-
-#fishingOperationValidPanel {
- floatable: false;
- borderPainted: false;
- opaque: false;
-}
-
-#resetValidStateButton {
- actionIcon: "reset";
- text: "tutti.action.reset.fishingOperationValidState";
-}
-
-#fishingOperationValidRadio {
- text: "tutti.label.fishingOperation.fishingOperationValid";
- selected: {model.getFishingOperationValid() == Boolean.TRUE};
- buttonGroup: "fishingOperationValid";
-}
-
-#fishingOperationInvalidRadio {
- text: "tutti.label.fishingOperation.fishingOperationInvalid";
- selected: {model.getFishingOperationValid() == Boolean.FALSE};
- buttonGroup: "fishingOperationValid";
-}
-#fishingOperationResetRadio {
- selected: {model.getFishingOperationValid() == null};
- buttonGroup: "fishingOperationValid";
-}
-
-#fishingOperationRectiligneCheckBox {
- text: "tutti.label.fishingOperation.fishingOperationRectiligne";
- selected: {model.isFishingOperationRectiligne()};
-}
-
-#distanceChaluteeLabel {
- text: "tutti.label.fishingOperation.distanceChalutee";
- labelFor: {distanceChaluteeField};
-}
-
-#distanceChaluteeField {
- property: "distanceChalutee";
- model: {model.getDistanceChalutee()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
- enabled: {!model.isFishingOperationRectiligne()};
-}
-
-#beaufortScaleLabel {
- text: "tutti.label.fishingOperation.beaufortScale";
- labelFor: {beaufortScaleComboBox};
-}
-
-#beaufortScaleComboBox {
- property: "beaufortScale";
- selectedItem: {model.getBeaufortScale()};
-}
-
-#windDirectionLabel {
- text: "tutti.label.fishingOperation.windDirection";
- labelFor: {windDirectionField};
-}
-
-#windDirectionField {
- property: "windDirection";
- model: {model.getWindDirection()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#seaStateLabel {
- text: "tutti.label.fishingOperation.seaState";
- labelFor: {seaStateComboBox};
-}
-
-#seaStateComboBox {
- property: "seaState";
- selectedItem: {model.getSeaState()};
-}
-
-#ouvertureHorizontaleLabel {
- text: "tutti.label.fishingOperation.ouvertureHorizontale";
- labelFor: {ouvertureHorizontaleField};
-}
-
-#ouvertureHorizontaleVerticaleLabel {
- text: "tutti.label.fishingOperation.ouvertureHorizontaleVerticale";
-}
-
-#ouvertureHorizontaleField {
- property: "ouvertureHorizontale";
- model: {model.getOuvertureHorizontale()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#ouvertureVerticaleLabel {
- text: "tutti.label.fishingOperation.ouvertureVerticale";
- labelFor: {ouvertureVerticaleField};
-}
-
-#ouvertureVerticaleField {
- property: "ouvertureVerticale";
- model: {model.getOuvertureVerticale()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#geometrieMesureeCheckBox {
- text: "tutti.label.fishingOperation.geometrieMesuree";
- selected: {model.isGeometrieMesuree()};
-}
-
-#longueurFunesLabel {
- text: "tutti.label.fishingOperation.longueurFunes";
- labelFor: {longueurFunesField};
-}
-
-#longueurFunesBrasLabel {
- text: "tutti.label.fishingOperation.longueurFunesBras";
-}
-
-#longueurFunesField {
- property: "longueurFunes";
- model: {model.getLongueurFunes()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#longueurBrasLabel {
- text: "tutti.label.fishingOperation.longueurBras";
- labelFor: {longueurBrasField};
-}
-
-#longueurBrasField {
- property: "longueurBras";
- model: {model.getLongueurBras()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#systemeFermetureCulCheckBox {
- text: "tutti.label.fishingOperation.systemeFermetureCul";
- selected: {model.isSystemeFermetureCul()};
-}
-
-#dureeLabel {
- text: "tutti.label.fishingOperation.duree";
- labelFor: {dureeField};
-}
-
-#dureeField {
- property: "duree";
- model: {model.getDuree()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#saisisseurList {
- beanType: {Person.class};
- property: "saisisseur";
- border: {BorderFactory.createTitledBorder(_("tutti.label.list.saisisseur"))};
-}
-
-#commentPane {
- columnHeaderView: {new JLabel(_("tutti.label.comment"))};
- minimumSize: {new Dimension(10,50)};
-}
-
-#commentField {
- text: {model.getComment()};
-}
-
-#gearShootingStartDepthLabel {
- text: "tutti.label.fishingOperation.gearShootingStartDepth";
- labelFor: {gearShootingStartDepthField};
-}
-
-#gearShootingStartDepthField {
- property: "gearShootingStartDepth";
- model: {model.getGearShootingStartDepth()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndDepthLabel {
- text: "tutti.label.fishingOperation.gearShootingEndDepth";
- labelFor: {gearShootingEndDepthField};
-}
-
-#gearShootingEndDepthField {
- property: "gearShootingEndDepth";
- model: {model.getGearShootingEndDepth()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartSurfaceTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingStartSurfaceTemperature";
- labelFor: {gearShootingStartSurfaceTemperatureField};
-}
-
-#gearShootingStartSurfaceTemperatureField {
- property: "gearShootingStartSurfaceTemperature";
- model: {model.getGearShootingStartSurfaceTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndSurfaceTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingEndSurfaceTemperature";
- labelFor: {gearShootingEndSurfaceTemperatureField};
-}
-
-#gearShootingEndSurfaceTemperatureField {
- property: "gearShootingEndSurfaceTemperature";
- model: {model.getGearShootingEndSurfaceTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartBottomTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingStartBottomTemperature";
- labelFor: {gearShootingStartBottomTemperatureField};
-}
-
-#gearShootingStartBottomTemperatureField {
- property: "gearShootingStartBottomTemperature";
- model: {model.getGearShootingStartBottomTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndBottomTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingEndBottomTemperature";
- labelFor: {gearShootingEndBottomTemperatureField};
-}
-
-#gearShootingEndBottomTemperatureField {
- property: "gearShootingEndBottomTemperature";
- model: {model.getGearShootingEndBottomTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#averageBottomTemperatureLabel {
- text: "tutti.label.fishingOperation.averageBottomTemperature";
- labelFor: {averageBottomTemperatureField};
-}
-
-#averageBottomTemperatureField {
- property: "averageBottomTemperature";
- model: {model.getAverageBottomTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartSurfaceSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingStartSurfaceSalinity";
- labelFor: {gearShootingStartSurfaceSalinityField};
-}
-
-#gearShootingStartSurfaceSalinityField {
- property: "gearShootingStartSurfaceSalinity";
- model: {model.getGearShootingStartSurfaceSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndSurfaceSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingEndSurfaceSalinity";
- labelFor: {gearShootingEndSurfaceSalinityField};
-}
-
-#gearShootingEndSurfaceSalinityField {
- property: "gearShootingEndSurfaceSalinity";
- model: {model.getGearShootingEndSurfaceSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartBottomSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingStartBottomSalinity";
- labelFor: {gearShootingStartBottomSalinityField};
-}
-
-#gearShootingStartBottomSalinityField {
- property: "gearShootingStartBottomSalinity";
- model: {model.getGearShootingStartBottomSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndBottomSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingEndBottomSalinity";
- labelFor: {gearShootingEndBottomSalinityField};
-}
-
-#gearShootingEndBottomSalinityField {
- property: "gearShootingEndBottomSalinity";
- model: {model.getGearShootingEndBottomSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#averageBottomSalinityLabel {
- text: "tutti.label.fishingOperation.averageBottomSalinity";
- labelFor: {averageBottomSalinityField};
-}
-
-#averageBottomSalinityField {
- property: "averageBottomSalinity";
- model: {model.getAverageBottomSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#noTraitPane {
- text: "tutti.label.no.fishingOperation.selected";
- horizontalAlignment: {JLabel.CENTER};
-}
-
-#saveButton {
- actionIcon: "save";
- text: "tutti.action.save";
- enabled: {model.isModify() && model.isValid()};
-}
-
-#cancelButton {
- actionIcon: "cancel";
- text: "tutti.action.cancel";
- enabled: {model.isModify()};
-}
-
-#importPupitriButton {
- actionIcon: "pupitri-import";
- text: "tutti.action.pupitri-import";
-}
-
-#importCasinoButton {
- actionIcon: "casino-import";
- text: "tutti.action.casino-import";
-}
-
-#messagePanel {
- border: {BorderFactory.createTitledBorder("Messages")};
- height: 200;
- width: 500;
-}
-
-#errorTable {
- rowSelectionAllowed: true;
- autoCreateRowSorter: true;
- autoResizeMode: 2;
- cellSelectionEnabled: false;
- selectionMode: 0;
- model: {errorTableModel};
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx 2012-12-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx 2012-12-19 10:16:51 UTC (rev 89)
@@ -1,558 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<JPanel id='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<FishingOperationTabUIModel, FishingOperationTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
- fr.ifremer.tutti.persistence.entities.referential.SeaState
- fr.ifremer.tutti.persistence.entities.referential.Strata
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
- fr.ifremer.tutti.persistence.entities.referential.Person
-
- fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor
- fr.ifremer.tutti.ui.swing.content.operation.fishing.EnvironmentTabUI
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
- jaxx.runtime.swing.editor.bean.BeanListHeader
- jaxx.runtime.swing.editor.bean.BeanDoubleList
- jaxx.runtime.swing.editor.NumberEditor
- jaxx.runtime.swing.editor.TimeEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- org.jdesktop.swingx.JXDatePicker
- org.jdesktop.swingx.JXTable
-
- java.awt.Dimension
-
- javax.swing.DefaultListModel
- javax.swing.ListSelectionModel
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
- </import>
-
- <script><![CDATA[
-
-public FishingOperationTabUI(FishingOperationsUI parentUI) {
- FishingOperationTabUIHandler handler = new FishingOperationTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <FishingOperationTabUIHandler id='handler'
- initializer='getContextValue(FishingOperationTabUIHandler.class)'/>
-
- <FishingOperationTabUIModel id='model'
- initializer='getContextValue(FishingOperationTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='stationNumber' component='stationNumberField'/>
- <field name='fishingOperationNumber'
- component='fishingOperationNumberField'/>
- <field name='date' component='dateField'/>
- <field name='comment' component='commentField'/>
- <field name='saisisseur' component='saisisseurList'/>
- </BeanValidator>
-
- <JPanel id='fishingOperationPane' constraints='BorderLayout.CENTER'
- layout='{new BorderLayout()}'>
-
- <JTabbedPane id='fishingOperationTabPane' constraints='BorderLayout.CENTER'>
- <tab id='traitGeneralTab'
- title='tutti.label.tab.fishingOperation.general'>
- <Table fill='both' id='generalForm'>
-
- <!-- Numero station / Numéro trait / Date -->
- <row>
- <cell anchor='west'>
- <JLabel id='stationNumberLabel'/>
- </cell>
- <cell weightx='0.3'>
- <NumberEditor id='stationNumberField' constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='fishingOperationNumberLabel'/>
- </cell>
- <cell weightx='0.3'>
- <NumberEditor id='fishingOperationNumberField'
- constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='dateLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JXDatePicker id='dateField'
- onActionPerformed='handler.setDate(event, "date")'/>
- </cell>
- </row>
-
- <!-- Strate d'association / Sous Strate / Localité -->
- <row>
- <cell>
- <JLabel id='strataLabel'/>
- </cell>
- <cell weightx='0.3'>
- <BeanComboBox id='strataComboBox' constructorParams='this'
- genericType='Strata'/>
- </cell>
- <cell>
- <JLabel id='subStrataLabel'/>
- </cell>
- <cell weightx='0.3'>
- <BeanComboBox id='subStrataComboBox' constructorParams='this'
- genericType='Strata'/>
- </cell>
- <cell>
- <JLabel id='localiteLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JTextField id='localiteField'
- onKeyReleased='handler.setText(event, "localite")'/>
- </cell>
- </row>
-
- <!-- début de traine long-lat-date-heure
- fin de traine long-lat-date-heure -->
- <row>
- <cell columns='6'>
- <JPanel layout="{new BorderLayout()}">
- <Table id="gearCaracteristicsTable" fill="both" weightx='1'
- constraints='BorderLayout.CENTER'>
- <row>
- <cell>
- <JLabel/>
- </cell>
- <cell>
- <JLabel id='gearLongitudeLabel'/>
- </cell>
- <cell>
- <JLabel id='gearLatitudeLabel'/>
- </cell>
- <cell>
- <JLabel id='gearDateLabel'/>
- </cell>
- <cell>
- <JLabel id='gearTimeLabel'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel id='gearShootingStartLabel'/>
- </cell>
- <cell>
- <JTextField id='gearShootingStartLongitudeField'
- onKeyReleased='handler.setGearShootingStartLongitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- <cell>
- <JTextField id='gearShootingStartLatitudeLabel'
- onKeyReleased='handler.setGearShootingStartLatitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- <cell>
- <JXDatePicker id='gearShootingStartDateField'
- onActionPerformed='handler.setDate(event, "gearShootingStartDate")'/>
- </cell>
- <cell>
- <SimpleTimeEditor id='gearShootingStartTimeField'
- constructorParams='this'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel id='gearShootingEndLabel'/>
- </cell>
- <cell>
- <JTextField id='gearShootingEndLongitudeField'
- onKeyReleased='handler.setGearShootingEndLongitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- <cell>
- <JTextField id='gearShootingEndLatitudeLabel'
- onKeyReleased='handler.setGearShootingEndLatitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- <cell>
- <JXDatePicker id='gearShootingEndDateField'
- onActionPerformed='handler.setDate(event, "gearShootingEndDate")'/>
- </cell>
- <cell>
- <SimpleTimeEditor id='gearShootingEndTimeField'
- constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- </row>
-
- <!-- Fishing operation valid / invalid-->
- <row>
- <cell>
- <JToolBar id='fishingOperationValidPanel'
- layout='{new BorderLayout()}'>
- <JButton id='resetValidStateButton'
- constraints='BorderLayout.WEST'
- onActionPerformed="model.setFishingOperationValid(null)"/>
- <JRadioButton id='fishingOperationResetRadio'
- constraints='BorderLayout.EAST'/>
- </JToolBar>
- </cell>
- <cell>
- <HBox>
- <JRadioButton id='fishingOperationValidRadio'
- onActionPerformed='model.setFishingOperationValid(Boolean.TRUE)'/>
- <JRadioButton id='fishingOperationInvalidRadio'
- onActionPerformed='model.setFishingOperationValid(Boolean.FALSE)'/>
- </HBox>
- </cell>
- <cell columns="4">
- <JPanel/>
- </cell>
- </row>
-
- <!-- FishingOperation rectiligne / distance chalutee / durée -->
- <row>
- <cell>
- <JCheckBox id='fishingOperationRectiligneCheckBox'
- onItemStateChanged='handler.setBoolean(event, "fishingOperationRectiligne")'/>
- </cell>
- <cell columns="3">
- <JPanel layout="{new BorderLayout()}">
- <JLabel id='distanceChaluteeLabel'
- constraints='BorderLayout.WEST'/>
- <NumberEditor id='distanceChaluteeField'
- constraints='BorderLayout.CENTER'
- constructorParams='this'/>
- </JPanel>
- </cell>
- <cell anchor='west'>
- <JLabel id='dureeLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='dureeField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Actions d'import -->
- <row>
- <cell columns='6'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton id='importPupitriButton'
- onActionPerformed='handler.importPupitri()'/>
- <JButton id='importCasinoButton'
- onActionPerformed='handler.importCasino()'/>
- </JPanel>
- </cell>
- </row>
-
- <!-- Saisisseur -->
- <row weighty='0.3'>
- <cell columns='6'>
- <!-- <JScrollPane id='saisisseurPane'
- columnHeaderView="{saisisseurHeader}"
- onFocusGained='saisisseurList.requestFocus()'>
- <JList id='saisisseurList'
- onValueChanged='handler.selectListData(event, "saisisseur")'/>
- <BeanListHeader id='saisisseurHeader' genericType='Person'/>
- </JScrollPane>-->
- <BeanDoubleList id='saisisseurList' genericType='Person'/>
- </cell>
- </row>
-
- <!-- Commentaire -->
- <row weighty='0.3'>
- <cell columns='6'>
- <JScrollPane id='commentPane'
- onFocusGained='commentField.requestFocus()'>
- <JTextArea id='commentField'
- onKeyReleased='handler.setText(event, "comment")'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </tab>
-
- <tab id='traitGearShootingTab'
- title='tutti.label.tab.fishingOperation.gearShooting'>
-
- <Table fill='both' id='gearShootingForm'>
-
- <!-- GearShootingStart Depth -->
- <row>
- <cell>
- <JLabel id='gearShootingStartDepthLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartDepthField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEnd Depth -->
- <row>
- <cell>
- <JLabel id='gearShootingEndDepthLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndDepthField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Ouverture horizontale -->
- <row>
- <cell anchor='west'>
- <JLabel id='ouvertureHorizontaleLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='ouvertureHorizontaleField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Ouverture verticale -->
- <row>
- <cell anchor='west'>
- <JLabel id='ouvertureVerticaleLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='ouvertureVerticaleField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Longueur funes -->
- <row>
- <cell anchor='west'>
- <JLabel id='longueurFunesLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='longueurFunesField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Longueur bras -->
- <row>
- <cell anchor='west'>
- <JLabel id='longueurBrasLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='longueurBrasField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Système de fermeture du cul / Geometrie mesuree -->
- <row>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JCheckBox id='systemeFermetureCulCheckBox'
- onItemStateChanged='handler.setBoolean(event, "systemeFermetureCul")'/>
- <JCheckBox id='geometrieMesureeCheckBox'
- onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
- </JPanel>
- </cell>
- </row>
- </Table>
- </tab>
-
- <tab id='environmentTab'
- title='tutti.label.tab.fishingOperation.environment'>
-
- <EnvironmentTabUI id='environmentTabContent' constructorParams='this'/>
-<!-- <Table fill='both' id='environmentForm'>
-
- Beaufort scale
- <row>
- <cell anchor='west'>
- <JLabel id='beaufortScaleLabel'/>
- </cell>
- <cell weightx='1.0'>
- <BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
- genericType='BeaufortScale'/>
- </cell>
- </row>
-
- Wind direction
- <row>
- <cell anchor='west'>
- <JLabel id='windDirectionLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='windDirectionField' constructorParams='this'/>
- </cell>
- </row>
-
- Sea state
- <row>
- <cell anchor='west'>
- <JLabel id='seaStateLabel'/>
- </cell>
- <cell fill='horizontal'>
- <BeanComboBox id='seaStateComboBox' constructorParams='this'
- genericType='SeaState'/>
- </cell>
- </row>
- </Table>-->
- </tab>
-
- <tab id='traitHydrologyTabContent'
- title='tutti.label.tab.fishingOperation.hydrology'>
-
- <Table fill='both' id='hydrologyForm'>
-
- <!-- GearShootingStartSurfaceTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingStartSurfaceTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartSurfaceTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndSurfaceTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingEndSurfaceTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndSurfaceTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingStartBottomTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingStartBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndBottomTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingEndBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- AverageBottomTemperature -->
- <row>
- <cell>
- <JLabel id='averageBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='averageBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingStartSurfaceSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingStartSurfaceSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartSurfaceSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndSurfaceSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingEndSurfaceSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndSurfaceSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingStartBottomSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingStartBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndBottomSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingEndBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- AverageBottomSalinity -->
- <row>
- <cell>
- <JLabel id='averageBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='averageBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- </Table>
- </tab>
- </JTabbedPane>
-
- <!-- Actions -->
- <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.SOUTH'>
- <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.CENTER'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='saveButton' onActionPerformed='handler.save()'/>
- </JPanel>
- </JPanel>
-
- </JPanel>
-
- <JLabel id='noTraitPane'/>
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-19 10:16:51 UTC (rev 89)
@@ -1,227 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import java.awt.BorderLayout;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-/**
- * Handler for UI {@link FishingOperationTabUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class FishingOperationTabUIHandler extends AbstractTuttiUIHandler<FishingOperationTabUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(FishingOperationTabUIHandler.class);
-
- private final FishingOperationTabUI ui;
-
- private final FishingOperationsUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public FishingOperationTabUIHandler(FishingOperationsUI parentUi, FishingOperationTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- FishingOperationTabUIModel model = new FishingOperationTabUIModel();
- model.addPropertyChangeListener(FishingOperationTabUIModel.PROPERTY_EMPTY, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- JPanel form = ui.getFishingOperationPane();
- JLabel noContentPane = ui.getNoTraitPane();
-
- Boolean empty = (Boolean) evt.getNewValue();
- ui.remove(form);
- ui.remove(noContentPane);
- if (empty) {
- ui.add(noContentPane, BorderLayout.CENTER);
- } else {
- ui.add(form, BorderLayout.CENTER);
- }
- ui.repaint();
- }
- });
-
- listModelIsModify(model);
-
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- ui.getFishingOperationValidPanel().remove(
- ui.getFishingOperationResetRadio());
-
- FishingOperationTabUIModel model = ui.getModel();
-
- initUI(ui);
-
- initBeanList(ui.getSaisisseurList(),
- persistenceService.getAllPerson(),
- model.getSaisisseur());
-
-// initBeanComboBox(ui.getBeaufortScaleComboBox(),
-// persistenceService.getAllBeaufortScale(),
-// model.getBeaufortScale());
-//
-// initBeanComboBox(ui.getStrataComboBox(),
-// persistenceService.getAllStrata(),
-// model.getStrata());
-//
-// initBeanComboBox(ui.getSeaStateComboBox(),
-// persistenceService.getAllSeaState(),
-// model.getSeaState());
-
- model.setEmpty(true);
-
- listenValidatorValid(ui.getValidator(), getModel());
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected FishingOperationTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectFishingOperation(FishingOperation bean) {
-
- boolean empty = bean == null;
-
- FishingOperationTabUIModel model = getModel();
-
- if (empty) {
-
- model.fromBean(new FishingOperation());
- } else {
-
- model.fromBean(bean);
- }
-
- // update saisissuer selection
- List<Person> saisisseur = model.getSaisisseur();
- ui.getSaisisseurList().getModel().setSelected(saisisseur);
-
- // update model empty property
- model.setEmpty(empty);
-
- // if new fishingOperation can already cancel his creation
- model.setModify(!empty && model.isCreate());
-
- ui.getEnvironmentTabContent().getHandler().afterInitUI();
- }
-
- public void cancel() {
-
- String id = getModel().getId();
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition for fishingOperation: " + id);
- }
- boolean newBean = StringUtils.isBlank(id);
-
- if (newBean) {
-
- // cancel to create a new fishingOperation
- parentUi.getHandler().selectFishingOperation(null);
-
- } else {
-
- // reselect in ui the fishingOperation
- FishingOperation selectedFishingOperation = parentUi.getModel().getSelectedFishingOperation();
- parentUi.getHandler().selectFishingOperation(selectedFishingOperation);
- }
- }
-
- public void save() {
-
- // get fishingOperation to save
- FishingOperation toSave = getModel().toBean();
-
- if (log.isInfoEnabled()) {
- log.info("Save edition for fishingOperation: " + toSave.getId());
- }
-
- // keep selected tab (to resotre it after save)
- int selectedIndex = ui.getFishingOperationTabPane().getSelectedIndex();
-
- // persist current fishingOperation
- parentUi.getHandler().saveFishingOperation(toSave);
-
- // reselect current tab
- ui.getFishingOperationTabPane().setSelectedIndex(selectedIndex);
-
- getModel().setModify(false);
- }
-
- public void importPupitri() {
- //TODO
- }
-
- public void importCasino() {
- //TODO
- }
-
- public void setGearShootingStartLatitude(String text) {
- getModel().setGearShootingStartLatitude(Float.valueOf(text));
- }
-
- public void setGearShootingStartLongitude(String text) {
- getModel().setGearShootingStartLongitude(Float.valueOf(text));
- }
-
- public void setGearShootingEndLatitude(String text) {
- getModel().setGearShootingEndLatitude(Float.valueOf(text));
- }
-
- public void setGearShootingEndLongitude(String text) {
- getModel().setGearShootingEndLongitude(Float.valueOf(text));
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java 2012-12-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java 2012-12-19 10:16:51 UTC (rev 89)
@@ -1,633 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.SeaState;
-import fr.ifremer.tutti.persistence.entities.referential.Strata;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * Model for UI {@link FishingOperationTabUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class FishingOperationTabUIModel extends AbstractTuttiBeanUIModel<FishingOperation, FishingOperationTabUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_EMPTY = "empty";
-
- public static final String PROPERTY_STATION_NUMBER = "stationNumber";
-
- public static final String PROPERTY_FISHING_OPERATION_NUMBER = "fishingOperationNumber";
-
- public static final String PROPERTY_DATE = "date";
-
- public static final String PROPERTY_STRATA = "strata";
-
- public static final String PROPERTY_SUB_STRATA = "subStrata";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE = "gearShootingStartLatitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE = "gearShootingStartLongitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_DATE = "gearShootingStartDate";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_DEPTH = "gearShootingStartDepth";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = "gearShootingEndLatitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = "gearShootingEndLongitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_DATE = "gearShootingEndDate";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth";
-
- public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale";
-
- public static final String PROPERTY_WIND_DIRECTION = "windDirection";
-
- public static final String PROPERTY_SEA_STATE = "seaState";
-
- public static final String PROPERTY_OUVERTURE_HORIZONTALE = "ouvertureHorizontale";
-
- public static final String PROPERTY_OUVERTURE_VERTICALE = "ouvertureVerticale";
-
- public static final String PROPERTY_GEOMETRIE_MESUREE = "geometrieMesuree";
-
- public static final String PROPERTY_LONGUEUR_FUNES = "longueurFunes";
-
- public static final String PROPERTY_LONGUEUR_BRAS = "longueurBras";
-
- public static final String PROPERTY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul";
-
- public static final String PROPERTY_FISHING_OPERATION_RECTILIGNE = "fishingOperationRectiligne";
-
- public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee";
-
- public static final String PROPERTY_DUREE = "duree";
-
- public static final String PROPERTY_FISHING_OPERATION_VALID = "fishingOperationValid";
-
- public static final String PROPERTY_LOCALITE = "localite";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_SAISISSEUR = "saisisseur";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE = "gearShootingStartSurfaceTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE = "gearShootingEndSurfaceTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE = "gearShootingStartBottomTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE = "gearShootingEndBottomTemperature";
-
- public static final String PROPERTY_AVERAGE_BOTTOM_TEMPERATURE = "averageBottomTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY = "gearShootingStartSurfaceSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY = "gearShootingEndSurfaceSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY = "gearShootingStartBottomSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY = "gearShootingEndBottomSalinity";
-
- public static final String PROPERTY_AVERAGE_BOTTOM_SALINITY = "averageBottomSalinity";
-
- protected boolean empty;
-
- protected Cruise cruise;
-
- protected Integer stationNumber;
-
- protected Integer fishingOperationNumber;
-
- protected Date date;
-
- protected Strata strata;
-
- protected Strata subStrata;
-
- protected Float gearShootingStartLatitude;
-
- protected Float gearShootingStartLongitude;
-
- protected Date gearShootingStartDate;
-
- protected Integer gearShootingStartTime;
-
- protected Float gearShootingStartDepth;
-
- protected Float gearShootingEndLatitude;
-
- protected Float gearShootingEndLongitude;
-
- protected Date gearShootingEndDate;
-
- protected Integer gearShootingEndTime;
-
- protected Float gearShootingEndDepth;
-
- protected BeaufortScale beaufortScale;
-
- protected Integer windDirection;
-
- protected SeaState seaState;
-
- protected Float ouvertureHorizontale;
-
- protected Float ouvertureVerticale;
-
- protected boolean geometrieMesuree;
-
- protected Float longueurFunes;
-
- protected Float longueurBras;
-
- protected boolean systemeFermetureCul;
-
- protected boolean fishingOperationRectiligne;
-
- protected Float distanceChalutee;
-
- protected Float duree;
-
- protected Boolean fishingOperationValid;
-
- protected String localite;
-
- protected String comment;
-
- protected List<Person> saisisseur;
-
- protected Float gearShootingStartSurfaceTemperature;
-
- protected Float gearShootingEndSurfaceTemperature;
-
- protected Float gearShootingStartBottomTemperature;
-
- protected Float gearShootingEndBottomTemperature;
-
- protected Float averageBottomTemperature;
-
- protected Float gearShootingStartSurfaceSalinity;
-
- protected Float gearShootingEndSurfaceSalinity;
-
- protected Float gearShootingStartBottomSalinity;
-
- protected Float gearShootingEndBottomSalinity;
-
- protected Float averageBottomSalinity;
-
- protected static Binder<FishingOperationTabUIModel, FishingOperation> toBeanBinder =
- BinderFactory.newBinder(FishingOperationTabUIModel.class,
- FishingOperation.class);
-
- protected static Binder<FishingOperation, FishingOperationTabUIModel> fromBeanBinder =
- BinderFactory.newBinder(FishingOperation.class, FishingOperationTabUIModel.class);
-
- public FishingOperationTabUIModel() {
- super(FishingOperation.class, fromBeanBinder, toBeanBinder);
- }
-
- public boolean isEmpty() {
- return empty;
- }
-
- public void setEmpty(boolean empty) {
- Object oldValue = isEmpty();
- this.empty = empty;
- firePropertyChange(PROPERTY_EMPTY, oldValue, empty);
- }
-
- public Cruise getCruise() {
- return cruise;
- }
-
- public void setCruise(Cruise cruise) {
- this.cruise = cruise;
- }
-
- public Integer getStationNumber() {
- return stationNumber;
- }
-
- public void setStationNumber(Integer stationNumber) {
- Object oldValue = getStationNumber();
- this.stationNumber = stationNumber;
- firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber);
- }
-
- public Integer getFishingOperationNumber() {
- return fishingOperationNumber;
- }
-
- public void setFishingOperationNumber(Integer fishingOperationNumber) {
- Object oldValue = getFishingOperationNumber();
- this.fishingOperationNumber = fishingOperationNumber;
- firePropertyChange(PROPERTY_FISHING_OPERATION_NUMBER, oldValue, fishingOperationNumber);
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- Object oldValue = getDate();
- this.date = date;
- firePropertyChange(PROPERTY_DATE, oldValue, date);
- }
-
- public Strata getStrata() {
- return strata;
- }
-
- public void setStrata(Strata strata) {
- Object oldValue = getStrata();
- this.strata = strata;
- firePropertyChange(PROPERTY_STRATA, oldValue, strata);
- }
-
- public Strata getSubStrata() {
- return subStrata;
- }
-
- public void setSubStrata(Strata subStrata) {
- Object oldValue = getSubStrata();
- this.subStrata = subStrata;
- firePropertyChange(PROPERTY_SUB_STRATA, oldValue, subStrata);
- }
-
- public Float getGearShootingStartLatitude() {
- return gearShootingStartLatitude;
- }
-
- public void setGearShootingStartLatitude(Float gearShootingStartLatitude) {
- Object oldValue = getGearShootingStartLatitude();
- this.gearShootingStartLatitude = gearShootingStartLatitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LATITUDE, oldValue, gearShootingStartLatitude);
- }
-
- public Float getGearShootingStartLongitude() {
- return gearShootingStartLongitude;
- }
-
- public void setGearShootingStartLongitude(Float gearShootingStartLongitude) {
- Object oldValue = getGearShootingStartLongitude();
- this.gearShootingStartLongitude = gearShootingStartLongitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE, oldValue, gearShootingStartLongitude);
- }
-
- public Date getGearShootingStartDate() {
- return gearShootingStartDate;
- }
-
- public void setGearShootingStartDate(Date gearShootingStartDate) {
- Object oldValue = getGearShootingStartDate();
- this.gearShootingStartDate = gearShootingStartDate;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DATE, oldValue, gearShootingStartDate);
- }
-
- public Float getGearShootingStartDepth() {
- return gearShootingStartDepth;
- }
-
- public void setGearShootingStartDepth(Float gearShootingStartDepth) {
- Object oldValue = getGearShootingStartDepth();
- this.gearShootingStartDepth = gearShootingStartDepth;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DEPTH, oldValue, gearShootingStartDepth);
- }
-
- public Float getGearShootingEndLatitude() {
- return gearShootingEndLatitude;
- }
-
- public void setGearShootingEndLatitude(Float gearShootingEndLatitude) {
- Object oldValue = getGearShootingEndLatitude();
- this.gearShootingEndLatitude = gearShootingEndLatitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE, oldValue, gearShootingEndLatitude);
- }
-
- public Float getGearShootingEndLongitude() {
- return gearShootingEndLongitude;
- }
-
- public void setGearShootingEndLongitude(Float gearShootingEndLongitude) {
- Object oldValue = getGearShootingEndLongitude();
- this.gearShootingEndLongitude = gearShootingEndLongitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE, oldValue, gearShootingEndLongitude);
- }
-
- public Date getGearShootingEndDate() {
- return gearShootingEndDate;
- }
-
- public void setGearShootingEndDate(Date gearShootingEndDate) {
- Object oldValue = getGearShootingEndDate();
- this.gearShootingEndDate = gearShootingEndDate;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, gearShootingEndDate);
- }
-
- public Float getGearShootingEndDepth() {
- return gearShootingEndDepth;
- }
-
- public void setGearShootingEndDepth(Float gearShootingEndDepth) {
- Object oldValue = getGearShootingEndDepth();
- this.gearShootingEndDepth = gearShootingEndDepth;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth);
- }
-
- public BeaufortScale getBeaufortScale() {
- return beaufortScale;
- }
-
- public void setBeaufortScale(BeaufortScale beaufortScale) {
- Object oldValue = getBeaufortScale();
- this.beaufortScale = beaufortScale;
- firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale);
- }
-
- public Integer getWindDirection() {
- return windDirection;
- }
-
- public void setWindDirection(Integer windDirection) {
- Object oldValue = getWindDirection();
- this.windDirection = windDirection;
- firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection);
- }
-
- public SeaState getSeaState() {
- return seaState;
- }
-
- public void setSeaState(SeaState seaState) {
- Object oldValue = getSeaState();
- this.seaState = seaState;
- firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState);
- }
-
- public Float getOuvertureHorizontale() {
- return ouvertureHorizontale;
- }
-
- public void setOuvertureHorizontale(Float ouvertureHorizontale) {
- Object oldValue = getOuvertureHorizontale();
- this.ouvertureHorizontale = ouvertureHorizontale;
- firePropertyChange(PROPERTY_OUVERTURE_HORIZONTALE, oldValue, ouvertureHorizontale);
- }
-
- public Float getOuvertureVerticale() {
- return ouvertureVerticale;
- }
-
- public void setOuvertureVerticale(Float ouvertureVerticale) {
- Object oldValue = getOuvertureVerticale();
- this.ouvertureVerticale = ouvertureVerticale;
- firePropertyChange(PROPERTY_OUVERTURE_VERTICALE, oldValue, ouvertureVerticale);
- }
-
- public boolean isGeometrieMesuree() {
- return geometrieMesuree;
- }
-
- public void setGeometrieMesuree(boolean geometrieMesuree) {
- Object oldValue = isGeometrieMesuree();
- this.geometrieMesuree = geometrieMesuree;
- firePropertyChange(PROPERTY_GEOMETRIE_MESUREE, oldValue, geometrieMesuree);
- }
-
- public Float getLongueurFunes() {
- return longueurFunes;
- }
-
- public void setLongueurFunes(Float longueurFunes) {
- Object oldValue = getLongueurFunes();
- this.longueurFunes = longueurFunes;
- firePropertyChange(PROPERTY_LONGUEUR_FUNES, oldValue, longueurFunes);
- }
-
- public Float getLongueurBras() {
- return longueurBras;
- }
-
- public void setLongueurBras(Float longueurBras) {
- Object oldValue = getLongueurBras();
- this.longueurBras = longueurBras;
- firePropertyChange(PROPERTY_LONGUEUR_BRAS, oldValue, longueurBras);
- }
-
- public boolean isSystemeFermetureCul() {
- return systemeFermetureCul;
- }
-
- public void setSystemeFermetureCul(boolean systemeFermetureCul) {
- Object oldValue = isSystemeFermetureCul();
- this.systemeFermetureCul = systemeFermetureCul;
- firePropertyChange(PROPERTY_SYSTEME_FERMETURE_CUL, oldValue, systemeFermetureCul);
- }
-
- public boolean isFishingOperationRectiligne() {
- return fishingOperationRectiligne;
- }
-
- public void setFishingOperationRectiligne(boolean fishingOperationRectiligne) {
- Object oldValue = isFishingOperationRectiligne();
- this.fishingOperationRectiligne = fishingOperationRectiligne;
- firePropertyChange(PROPERTY_FISHING_OPERATION_RECTILIGNE, oldValue, fishingOperationRectiligne);
- }
-
- public Float getDistanceChalutee() {
- return distanceChalutee;
- }
-
- public void setDistanceChalutee(Float distanceChalutee) {
- Object oldValue = getDistanceChalutee();
- this.distanceChalutee = distanceChalutee;
- firePropertyChange(PROPERTY_DISTANCE_CHALUTEE, oldValue, distanceChalutee);
- }
-
- public Float getDuree() {
- return duree;
- }
-
- public void setDuree(Float duree) {
- Object oldValue = getDuree();
- this.duree = duree;
- firePropertyChange(PROPERTY_DUREE, oldValue, duree);
- }
-
- public Boolean getFishingOperationValid() {
- return fishingOperationValid;
- }
-
- public void setFishingOperationValid(Boolean fishingOperationValid) {
- Object oldValue = getFishingOperationValid();
- this.fishingOperationValid = fishingOperationValid;
- firePropertyChange(PROPERTY_FISHING_OPERATION_VALID, oldValue, fishingOperationValid);
- }
-
- public String getLocalite() {
- return localite;
- }
-
- public void setLocalite(String localite) {
- Object oldValue = getLocalite();
- this.localite = localite;
- firePropertyChange(PROPERTY_LOCALITE, oldValue, localite);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public List<Person> getSaisisseur() {
- return saisisseur;
- }
-
- public void setSaisisseur(List<Person> saisisseur) {
- this.saisisseur = saisisseur;
- firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur);
- }
-
- public Float getGearShootingStartSurfaceTemperature() {
- return gearShootingStartSurfaceTemperature;
- }
-
- public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) {
- Object oldValue = getGearShootingStartSurfaceTemperature();
- this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE, oldValue, gearShootingStartSurfaceTemperature);
- }
-
- public Float getGearShootingEndSurfaceTemperature() {
- return gearShootingEndSurfaceTemperature;
- }
-
- public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) {
- Object oldValue = getGearShootingEndSurfaceTemperature();
- this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE, oldValue, gearShootingEndSurfaceTemperature);
- }
-
- public Float getGearShootingStartBottomTemperature() {
- return gearShootingStartBottomTemperature;
- }
-
- public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) {
- Object oldValue = getGearShootingStartBottomTemperature();
- this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE, oldValue, gearShootingStartBottomTemperature);
- }
-
- public Float getGearShootingEndBottomTemperature() {
- return gearShootingEndBottomTemperature;
- }
-
- public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) {
- Object oldValue = getGearShootingEndBottomTemperature();
- this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE, oldValue, gearShootingEndBottomTemperature);
- }
-
- public Float getAverageBottomTemperature() {
- return averageBottomTemperature;
- }
-
- public void setAverageBottomTemperature(Float averageBottomTemperature) {
- Object oldValue = getAverageBottomTemperature();
- this.averageBottomTemperature = averageBottomTemperature;
- firePropertyChange(PROPERTY_AVERAGE_BOTTOM_TEMPERATURE, oldValue, averageBottomTemperature);
- }
-
- public Float getGearShootingStartSurfaceSalinity() {
- return gearShootingStartSurfaceSalinity;
- }
-
- public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) {
- Object oldValue = getGearShootingStartSurfaceSalinity();
- this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY, oldValue, gearShootingStartSurfaceSalinity);
- }
-
- public Float getGearShootingEndSurfaceSalinity() {
- return gearShootingEndSurfaceSalinity;
- }
-
- public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) {
- Object oldValue = getGearShootingEndSurfaceSalinity();
- this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY, oldValue, gearShootingEndSurfaceSalinity);
- }
-
- public Float getGearShootingStartBottomSalinity() {
- return gearShootingStartBottomSalinity;
- }
-
- public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) {
- Object oldValue = getGearShootingStartBottomSalinity();
- this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY, oldValue, gearShootingStartBottomSalinity);
- }
-
- public Float getGearShootingEndBottomSalinity() {
- return gearShootingEndBottomSalinity;
- }
-
- public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) {
- Object oldValue = getGearShootingEndBottomSalinity();
- this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY, oldValue, gearShootingEndBottomSalinity);
- }
-
- public Float getAverageBottomSalinity() {
- return averageBottomSalinity;
- }
-
- public void setAverageBottomSalinity(Float averageBottomSalinity) {
- Object oldValue = getAverageBottomSalinity();
- this.averageBottomSalinity = averageBottomSalinity;
- firePropertyChange(PROPERTY_AVERAGE_BOTTOM_SALINITY, oldValue, averageBottomSalinity);
- }
-}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-19 10:16:51 UTC (rev 89)
@@ -74,7 +74,7 @@
<JTabbedPane id='tabPane' constraints='BorderLayout.CENTER'>
<tab id='fishingOperationTab' title='tutti.label.tab.fishingOperation'>
- <FishingOperationTabUI id='fishingOperationTabContent' constructorParams='this'/>
+ <EditFishingOperationUI id='fishingOperationTabContent' constructorParams='this'/>
</tab>
<tab id='speciesTab' title='tutti.label.tab.species'>
<SpeciesBatchUI id='speciesTabContent' constructorParams='this'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx 2012-12-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx 2012-12-19 10:16:51 UTC (rev 89)
@@ -25,7 +25,7 @@
<import>
org.jdesktop.swingx.JXTable
- fr.ifremer.tutti.ui.swing.content.operation.FishingOperationTabUI
+ fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI
javax.swing.ListSelectionModel
java.awt.Color
</import>
@@ -54,7 +54,7 @@
</row>
<script><![CDATA[
-public EnvironmentTabUI(FishingOperationTabUI parentUI) {
+public EnvironmentTabUI(EditFishingOperationUI parentUI) {
EnvironmentTabUIHandler handler = new EnvironmentTabUIHandler(parentUI, this);
setContextValue(handler);
handler.beforeInitUI();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java 2012-12-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java 2012-12-19 10:16:51 UTC (rev 89)
@@ -25,18 +25,16 @@
*/
import com.google.common.collect.Lists;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationTabUI;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
-import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
-import javax.swing.plaf.basic.BasicComboBoxUI.ListDataHandler;
import javax.swing.table.TableColumnModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -54,7 +52,7 @@
protected EnvironmentTabUI ui;
- public EnvironmentTabUIHandler(FishingOperationTabUI parentUi, EnvironmentTabUI ui) {
+ public EnvironmentTabUIHandler(EditFishingOperationUI parentUi, EnvironmentTabUI ui) {
super(parentUi.getHandler().getContext());
this.ui = ui;
}
Copied: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-error-validation.xml (from rev 88, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml)
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-error-validation.xml (rev 0)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-error-validation.xml 2012-12-19 10:16:51 UTC (rev 89)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="stationNumber">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.stationNumber.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="date">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.date.required</message>
+ </field-validator>
+
+ </field>
+</validators>
Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-error-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml 2012-12-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml 2012-12-19 10:16:51 UTC (rev 89)
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="stationNumber">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.stationNumber.required</message>
- </field-validator>
-
- </field>
-
- <field name="date">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.date.required</message>
- </field-validator>
-
- </field>
-</validators>
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-18 19:13:34 UTC (rev 88)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-19 10:16:51 UTC (rev 89)
@@ -90,7 +90,7 @@
tutti.label.fishingOperation.ouvertureHorizontale=Ouverture horizontale
tutti.label.fishingOperation.ouvertureVerticale=Ouverture verticale
tutti.label.fishingOperation.seaState=Etat de la mer
-tutti.label.fishingOperation.stationNumber=Numéro de la station
+tutti.label.fishingOperation.stationNumber=Code Station
tutti.label.fishingOperation.strata=Strate
tutti.label.fishingOperation.subStrata=Sous strate
tutti.label.fishingOperation.systemeFermetureCul=Système de fermeture de cul
1
0
Dec. 18, 2012
Author: tchemit
Date: 2012-12-18 20:13:34 +0100 (Tue, 18 Dec 2012)
New Revision: 88
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/88
Log:
add protocol + pmfm (refs #1811: [Protocole] S?\195?\169lection d'un protocole)
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIModel.java
Removed:
trunk/tutti-application/
Modified:
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.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-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -33,6 +33,7 @@
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -113,7 +114,7 @@
Program saveProgram(Program bean);
//------------------------------------------------------------------------//
- //-- Cruise methods --//
+ //-- Cruise methods --//
//------------------------------------------------------------------------//
List<Cruise> getAllCruise(String programId);
@@ -125,6 +126,18 @@
Cruise saveCruise(Cruise bean);
//------------------------------------------------------------------------//
+ //-- Protocol methods --//
+ //------------------------------------------------------------------------//
+
+ List<TuttiProtocol> getAllProtocol();
+
+ TuttiProtocol getProtocol(String id);
+
+ TuttiProtocol createProtocol(TuttiProtocol bean);
+
+ TuttiProtocol saveProtocol(TuttiProtocol bean);
+
+ //------------------------------------------------------------------------//
//-- FishingOperation methods --//
//------------------------------------------------------------------------//
Modified: trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
===================================================================
--- trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-18 19:13:34 UTC (rev 88)
@@ -8,6 +8,7 @@
fr.ifremer.tutti.persistence.entities.data.Cruise
fr.ifremer.tutti.persistence.entities.data.SpeciesBatch
fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency
+fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol
fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
fr.ifremer.tutti.persistence.entities.referential.Country
fr.ifremer.tutti.persistence.entities.referential.Gear
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties
===================================================================
--- trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties 2012-12-18 19:13:34 UTC (rev 88)
@@ -22,7 +22,7 @@
# #L%
###
-model.tagvalue.version=0.2
+model.tagvalue.version=0.3
model.tagvalue.constantPrefix=PROPERTY_
model.tagvalue.doNotGenerateBooleanGetMethods=true
model.tagvalue.noPCS=true
@@ -33,3 +33,9 @@
fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.headOfSortRoom.stereotype=ordered
fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.vessel.stereotype=ordered
fr.ifremer.tutti.persistence.entities.data.FishingOperation.attribute.saisisseur.stereotype=ordered
+
+fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.gearPmfmId.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.environmentPmfmId.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.hydrologyPmfmId.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.species.stereotype=ordered
+
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -34,6 +34,7 @@
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -85,6 +86,10 @@
public void close() throws IOException {
}
+ //------------------------------------------------------------------------//
+ //-- Referential methods --//
+ //------------------------------------------------------------------------//
+
@Override
public List<SortedUnsortedCategory> getAllSortedUnsortedCategory() {
return null;
@@ -150,6 +155,10 @@
return null;
}
+ //------------------------------------------------------------------------//
+ //-- Program methods --//
+ //------------------------------------------------------------------------//
+
@Override
public List<Program> getAllProgram() {
return null;
@@ -170,6 +179,10 @@
return null;
}
+ //------------------------------------------------------------------------//
+ //-- Cruise methods --//
+ //------------------------------------------------------------------------//
+
@Override
public List<Cruise> getAllCruise(String programId) {
return null;
@@ -190,7 +203,35 @@
return null;
}
+ //------------------------------------------------------------------------//
+ //-- Protocol methods --//
+ //------------------------------------------------------------------------//
+
@Override
+ public List<TuttiProtocol> getAllProtocol() {
+ return null;
+ }
+
+ @Override
+ public TuttiProtocol getProtocol(String id) {
+ return null;
+ }
+
+ @Override
+ public TuttiProtocol createProtocol(TuttiProtocol bean) {
+ return null;
+ }
+
+ @Override
+ public TuttiProtocol saveProtocol(TuttiProtocol bean) {
+ return null;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Fishing operation methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
public List<FishingOperation> getAllFishingOperation(String cruiseId) {
return null;
}
@@ -210,6 +251,10 @@
return null;
}
+ //------------------------------------------------------------------------//
+ //-- Species Batch methods --//
+ //------------------------------------------------------------------------//
+
@Override
public List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId) {
return null;
@@ -244,6 +289,10 @@
return null;
}
+ //------------------------------------------------------------------------//
+ //-- Benthos Batch methods --//
+ //------------------------------------------------------------------------//
+
@Override
public List<BenthosBatch> getAllBenthosBatch(String fishingOperationId) {
return null;
@@ -268,6 +317,10 @@
public void deleteBenthosBatch(String id) {
}
+ //------------------------------------------------------------------------//
+ //-- Plancton Batch methods --//
+ //------------------------------------------------------------------------//
+
@Override
public List<PlanktonBatch> getAllPlanktonBatch(String fishingOperationId) {
return null;
@@ -292,6 +345,10 @@
public void deletePlanktonBatch(String id) {
}
+ //------------------------------------------------------------------------//
+ //-- Macrodechet Batch methods --//
+ //------------------------------------------------------------------------//
+
@Override
public List<MacroWasteBatch> getAllMacroWasteBatch(String fishingOperationId) {
return null;
@@ -316,6 +373,10 @@
public void deleteMacroWasteBatch(String id) {
}
+ //------------------------------------------------------------------------//
+ //-- Accidental Batch methods --//
+ //------------------------------------------------------------------------//
+
@Override
public List<AccidentalBatch> getAllAccidentalBatch(String fishingOperationId) {
return null;
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-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -45,6 +45,7 @@
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -316,6 +317,35 @@
}
//------------------------------------------------------------------------//
+ //-- Protocol methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public List<TuttiProtocol> getAllProtocol() {
+ List<TuttiProtocol> result = getDataInNewList(TuttiProtocol.class);
+ return result;
+ }
+
+ @Override
+ public TuttiProtocol getProtocol(String id) {
+ TuttiProtocol result = getBean(TuttiProtocol.class, id);
+ return result;
+ }
+
+ @Override
+ public TuttiProtocol createProtocol(TuttiProtocol bean) {
+ TuttiProtocol result = create(TuttiProtocol.class, bean);
+ return result;
+ }
+
+ @Override
+ public TuttiProtocol saveProtocol(TuttiProtocol bean) {
+ TuttiProtocol result = save(TuttiProtocol.class, bean);
+ return result;
+ }
+
+
+ //------------------------------------------------------------------------//
//-- FishingOperation methods --//
//------------------------------------------------------------------------//
@@ -511,7 +541,7 @@
}
//------------------------------------------------------------------------//
- //-- Accidentel Batch methods --//
+ //-- Accidental Batch methods --//
//------------------------------------------------------------------------//
@Override
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-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -28,6 +28,7 @@
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -91,6 +92,7 @@
registerMultiJXPathDecorator(Program.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(Cruise.class, "${name}$s", SEPARATOR, " - ");
+ registerMultiJXPathDecorator(TuttiProtocol.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(FishingOperation.class, "${stationNumber}$s#${fishingOperationNumber}$s#${date}$td/%3$tm/%3$tY", SEPARATOR, " - ");
registerMultiJXPathDecorator(Zone.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(Vessel.class, "${name}$s", SEPARATOR, " - ");
@@ -114,6 +116,7 @@
}
static {
+ n_("tutti.property.protocol");
n_("tutti.property.name");
n_("tutti.property.firstName");
n_("tutti.property.lastName");
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-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -35,6 +35,7 @@
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -241,7 +242,7 @@
}
//------------------------------------------------------------------------//
- //-- Cruise methods --//
+ //-- Cruise methods --//
//------------------------------------------------------------------------//
@Override
@@ -269,6 +270,35 @@
}
//------------------------------------------------------------------------//
+ //-- Protocol methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public List<TuttiProtocol> getAllProtocol() {
+ checkDriverExists();
+ return driver.getAllProtocol();
+ }
+
+ @Override
+ public TuttiProtocol getProtocol(String id) {
+ checkDriverExists();
+ return driver.getProtocol(id);
+ }
+
+ @Override
+ public TuttiProtocol createProtocol(TuttiProtocol bean) {
+ checkDriverExists();
+ return driver.createProtocol(bean);
+ }
+
+ @Override
+ public TuttiProtocol saveProtocol(TuttiProtocol bean) {
+ checkDriverExists();
+ return driver.saveProtocol(bean);
+ }
+
+
+ //------------------------------------------------------------------------//
//-- FishingOperation methods --//
//------------------------------------------------------------------------//
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-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-12-18 19:13:34 UTC (rev 88)
@@ -9,6 +9,7 @@
tutti.property.country=Pays
tutti.property.cruise=Campagne
tutti.property.date=Date
+tutti.property.protocol=Protocol de saisie
tutti.property.firstName=Prénom
tutti.property.fishingOperation=Trait
tutti.property.gear=Engin
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2012-12-18 19:13:34 UTC (rev 88)
@@ -57,7 +57,7 @@
text: "tutti.action.manageProtocol";
toolTipText: "tutti.action.manageProtocol.tip";
mnemonic: P;
- enabled: {model.getScreen() != TuttiScreen.EDIT_PROTOCOL};
+ enabled: {model.getScreen() != TuttiScreen.EDIT_PROTOCOL && model.getProtocolId() != null};
/*actionIcon: "protocol";*/
}
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-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -26,6 +26,7 @@
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.config.TuttiServiceConfigOption;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
@@ -34,6 +35,7 @@
import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUI;
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.content.program.EditProgramUI;
+import fr.ifremer.tutti.ui.swing.protocol.EditProtocolUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.AboutPanel;
@@ -319,8 +321,9 @@
closeCurrentBody();
- String surveyId = context.getProgramId();
- String campaignId = context.getCruiseId();
+ String programId = context.getProgramId();
+ String cruiseId = context.getCruiseId();
+ String protocolId = context.getProtocolId();
JComponent screenUI;
String screenTitle;
@@ -335,7 +338,7 @@
case EDIT_PROGRAM:
- if (surveyId == null) {
+ if (programId == null) {
screenTitle = _("tutti.title.create.program");
} else {
screenTitle = _("tutti.title.edit.program");
@@ -346,7 +349,7 @@
case EDIT_CRUISE:
- if (campaignId == null) {
+ if (cruiseId == null) {
screenTitle = _("tutti.title.create.cruise");
} else {
screenTitle = _("tutti.title.edit.cruise");
@@ -355,6 +358,17 @@
screenUI = new EditCruiseUI(context);
break;
+ case EDIT_PROTOCOL:
+
+ if (protocolId == null) {
+ screenTitle = _("tutti.title.create.protocol");
+ } else {
+ screenTitle = _("tutti.title.edit.protocol");
+ }
+
+ screenUI = new EditProtocolUI(context);
+ break;
+
case EDIT_FISHING_OPERATION:
screenTitle = _("tutti.title.edit.operations", getSelectedCruiseTitle());
@@ -438,11 +452,11 @@
protected String getSelectedCruiseTitle() {
- String surveyId = context.getProgramId();
+ String programId = context.getProgramId();
String title;
- if (surveyId == null) {
+ if (programId == null) {
// no program selected (so neither cruise)
@@ -452,27 +466,47 @@
// selected program
- Program program = persistenceService.getProgram(surveyId);
+ Program program = persistenceService.getProgram(programId);
title = _("tutti.title.selectedProgram", program.getName()) + " / ";
- String campaignId = context.getCruiseId();
+ String cruiseId = context.getCruiseId();
- if (campaignId == null) {
+ if (cruiseId == null) {
// no selected cruise
title += _("tutti.title.noSelectedCruise");
-
} else {
// selected cruise
Cruise cruise;
- cruise = persistenceService.getCruise(campaignId);
+ cruise = persistenceService.getCruise(cruiseId);
title += _("tutti.title.selectedCruise", cruise.getName());
}
+
+ title += " / ";
+
+ String protocolId = context.getProtocolId();
+
+ if (protocolId == null) {
+
+ // no selected protocol
+
+ title += _("tutti.title.noSelectedProtocol");
+
+
+ } else {
+
+ // selected protocol
+ TuttiProtocol protocol = persistenceService.getProtocol(protocolId);
+
+ title += _("tutti.title.selectedProtocol", protocol.getName());
+ }
+
+
}
return title;
}
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-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -59,6 +59,8 @@
public static final String PROPERTY_CRUISE_ID = "cruiseId";
+ public static final String PROPERTY_PROTOCOL_ID = "protocolId";
+
public static final String PROPERTY_SCREEN = "screen";
public static final String PROPERTY_CRUISE_CONTEXT_FILLED = "cruiseContextFilled";
@@ -106,6 +108,13 @@
protected String cruiseId;
/**
+ * Id of last selected protocol (can be null if none ever selected).
+ *
+ * @since 0.1
+ */
+ protected String protocolId;
+
+ /**
* Current screen displayed in ui.
*
* @since 0.1
@@ -146,6 +155,10 @@
return cruiseId;
}
+ public String getProtocolId() {
+ return protocolId;
+ }
+
public boolean isCruiseContextFilled() {
return StringUtils.isNotBlank(programId) &&
StringUtils.isNotBlank(cruiseId);
@@ -177,6 +190,15 @@
oldValue, isCruiseContextFilled());
}
+ public void setProtocolId(String protocolId) {
+
+ this.protocolId = protocolId;
+
+ // always propagate the change
+ firePropertyChange(PROPERTY_PROTOCOL_ID, null, protocolId);
+
+ }
+
public void setScreen(TuttiScreen screen) {
Object oldValue = getScreen();
this.screen = screen;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -89,7 +89,6 @@
} catch (IOException e) {
throw Throwables.propagate(e);
}
-
}
public ApplicationConfig getApplicationConfig() {
@@ -130,6 +129,11 @@
return applicationConfig.getOption(TuttiConfigOption.CRUISE_ID.getKey());
}
+ public String getProtocolId() {
+ return applicationConfig.getOption(TuttiConfigOption.PROTOCOL_ID.getKey());
+ }
+
+
public KeyStroke getShortCut(String actionName) {
KeyStroke result = applicationConfig.getOptionAsKeyStroke(
"tutti.ui." + actionName);
@@ -170,7 +174,6 @@
applicationConfig.setOption(TuttiConfigOption.PROGRAM_ID.getKey(), programId);
}
-
}
public void setCruiseId(String cruiseId) {
@@ -182,4 +185,14 @@
applicationConfig.setOption(TuttiConfigOption.CRUISE_ID.getKey(), cruiseId);
}
}
+
+ public void setProtocolId(String protocolId) {
+ if (protocolId == null) {
+ Properties options = applicationConfig.getOptions();
+ options.remove(TuttiConfigOption.PROTOCOL_ID.getKey());
+ applicationConfig.setOptions(options);
+ } else {
+ applicationConfig.setOption(TuttiConfigOption.PROTOCOL_ID.getKey(), protocolId);
+ }
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -53,6 +53,11 @@
null,
String.class
),
+ PROTOCOL_ID("tutti.protocolId",
+ n_("tutti.config.protocolId"),
+ null,
+ String.class
+ ),
// UI CONFIG (should be moved to ui module)
AUTO_POPUP_NUMBER_EDITOR("tutti.ui.autoPopupNumberEditor",
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2012-12-18 19:13:34 UTC (rev 88)
@@ -182,7 +182,7 @@
enabled: {model.isCanGenerateName()};
}
#messagePanel {
- border: {BorderFactory.createTitledBorder("Messages")};
+ border: {BorderFactory.createTitledBorder(_("tutti.title.messages"))};
height: 200;
width: 500;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -25,8 +25,8 @@
*/
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
@@ -35,6 +35,8 @@
import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
import jaxx.runtime.validator.swing.SwingValidatorUtil;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import java.util.List;
@@ -46,8 +48,21 @@
*/
public class EditCruiseUIHandler extends AbstractTuttiUIHandler<EditCruiseUIModel> {
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(EditCruiseUIHandler.class);
+
+ /**
+ * UI.
+ *
+ * @since 0.1
+ */
private final EditCruiseUI ui;
+ /**
+ * Persistence service.
+ *
+ * @since 0.1
+ */
private final PersistenceService persistenceService;
public EditCruiseUIHandler(TuttiUIContext context, EditCruiseUI ui) {
@@ -61,21 +76,28 @@
EditCruiseUIModel model = new EditCruiseUIModel();
- String campaignId = context.getCruiseId();
- if (campaignId == null) {
+ String cruiseId = context.getCruiseId();
+ if (cruiseId == null) {
// create new cruise
Program program =
persistenceService.getProgram(context.getProgramId());
model.setProgram(program);
model.setPoche(1);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Will create a new cruise from program: " + program);
+ }
} else {
// load existing program
Cruise cruise =
- persistenceService.getCruise(campaignId);
+ persistenceService.getCruise(cruiseId);
model.fromBean(cruise);
+ if (log.isDebugEnabled()) {
+ log.debug("Will edit cruise: " + cruiseId);
+ }
}
listModelIsModify(model);
ui.setContextValue(model);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2012-12-18 19:13:34 UTC (rev 88)
@@ -71,6 +71,28 @@
text: "tutti.action.new";
}
+#protocolLabel {
+ text: "tutti.label.protocol";
+ labelFor: {protocolCombobox};
+}
+
+#protocolCombobox {
+ property: "protocol";
+ selectedItem: {model.getProtocol()};
+}
+
+#editProtocolButton {
+ enabled: {model.isProtocolFound()};
+ text: "tutti.action.edit";
+ actionIcon: "edit";
+}
+
+#newProtocolButton {
+ actionIcon: "add";
+ enabled: true;
+ text: "tutti.action.new";
+}
+
#showFishingOperationsButton {
text: "tutti.action.catches";
enabled: {uiContext.isCruiseContextFilled()};
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 2012-12-18 19:13:34 UTC (rev 88)
@@ -27,6 +27,7 @@
<import>
fr.ifremer.tutti.persistence.entities.data.Program
fr.ifremer.tutti.persistence.entities.data.Cruise
+ fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol
fr.ifremer.tutti.ui.swing.TuttiUIContext
jaxx.runtime.swing.editor.bean.BeanComboBox
@@ -93,6 +94,23 @@
</cell>
</row>
<row>
+ <cell>
+ <JLabel id='protocolLabel'/>
+ </cell>
+ <cell>
+ <BeanComboBox id='protocolCombobox' constructorParams='this'
+ genericType='TuttiProtocol'/>
+ </cell>
+ <cell>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='editProtocolButton'
+ onActionPerformed='handler.showSelectedProtocol()'/>
+ <JButton id='newProtocolButton'
+ onActionPerformed='handler.showNewProtocol()'/>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
<cell columns='3'>
<JButton id='showFishingOperationsButton'
onActionPerformed='handler.showFishingOperations()'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -26,8 +26,9 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.TuttiScreen;
@@ -72,11 +73,10 @@
public void beforeInitUI() {
SelectCruiseUIModel model = new SelectCruiseUIModel();
- List<Program> allPrograms = persistenceService.getAllProgram();
+ List<Program> programs = persistenceService.getAllProgram();
+ model.setPrograms(programs);
- model.setPrograms(allPrograms);
-
- if (allPrograms.isEmpty()) {
+ if (programs.isEmpty()) {
// do nothing
if (log.isDebugEnabled()) {
@@ -88,29 +88,48 @@
String programId = context.getProgramId();
Program selectedProgram = null;
- List<Cruise> allCruises = null;
+ List<Cruise> cruises = null;
if (programId != null) {
- selectedProgram = TuttiEntities.findById(allPrograms, programId);
- allCruises = persistenceService.getAllCruise(programId);
+ selectedProgram = TuttiEntities.findById(programs, programId);
+ cruises = persistenceService.getAllCruise(programId);
}
model.setProgram(selectedProgram);
- model.setCruises(allCruises);
+ model.setCruises(cruises);
- if (CollectionUtils.isEmpty(allCruises)) {
+ if (CollectionUtils.isEmpty(cruises)) {
// nothing to select
} else {
String cruiseId = context.getCruiseId();
- Cruise selectedCampaign = null;
+ Cruise selectedCruise = null;
if (cruiseId != null) {
- selectedCampaign =
- TuttiEntities.findById(allCruises, cruiseId);
+ selectedCruise =
+ TuttiEntities.findById(cruises, cruiseId);
}
- model.setCruise(selectedCampaign);
+ model.setCruise(selectedCruise);
}
}
+
+ List<TuttiProtocol> protocols = persistenceService.getAllProtocol();
+ model.setProtocols(protocols);
+
+ if (protocols.isEmpty()) {
+ // do nothing
+
+ if (log.isDebugEnabled()) {
+ log.debug("No protocol found.");
+ }
+ } else {
+
+ String protocolId = context.getProtocolId();
+ TuttiProtocol selectedProtocol = null;
+ if (protocolId != null) {
+ selectedProtocol = TuttiEntities.findById(protocols, protocolId);
+ }
+ model.setProtocol(selectedProtocol);
+ }
ui.setContextValue(model);
}
@@ -127,6 +146,10 @@
model.getCruises(),
model.getCruise());
+ initBeanComboBox(ui.getProtocolCombobox(),
+ model.getProtocols(),
+ model.getProtocol());
+
model.addPropertyChangeListener(SelectCruiseUIModel.PROPERTY_PROGRAM, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
@@ -163,6 +186,14 @@
context.setCruiseId(newValue == null ? null : newValue.getId());
}
});
+
+ model.addPropertyChangeListener(SelectCruiseUIModel.PROPERTY_PROTOCOL, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ TuttiProtocol newValue = (TuttiProtocol) evt.getNewValue();
+ context.setProtocolId(newValue == null ? null : newValue.getId());
+ }
+ });
}
@Override
@@ -201,4 +232,15 @@
context.setCruiseId(null);
context.setScreen(TuttiScreen.EDIT_CRUISE);
}
+
+ public void showSelectedProtocol() {
+ TuttiProtocol protocol = getModel().getProtocol();
+ context.setProtocolId(protocol.getId());
+ context.setScreen(TuttiScreen.EDIT_PROTOCOL);
+ }
+
+ public void showNewProtocol() {
+ context.setProtocolId(null);
+ context.setScreen(TuttiScreen.EDIT_PROTOCOL);
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -26,6 +26,7 @@
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import org.jdesktop.beans.AbstractSerializableBean;
import java.util.List;
@@ -48,10 +49,16 @@
public static final String PROPERTY_CRUISE = "cruise";
+ public static final String PROPERTY_PROTOCOLS = "protocols";
+
+ public static final String PROPERTY_PROTOCOL = "protocol";
+
public static final String PROPERTY_PROGRAM_FOUND = "programFound";
public static final String PROPERTY_CRUISE_FOUND = "cruiseFound";
+ public static final String PROPERTY_PROTOCOL_FOUND = "protocolFound";
+
protected List<Program> programs;
protected Program program;
@@ -60,6 +67,10 @@
protected Cruise cruise;
+ protected List<TuttiProtocol> protocols;
+
+ protected TuttiProtocol protocol;
+
public List<Program> getPrograms() {
return programs;
}
@@ -67,9 +78,6 @@
public void setPrograms(List<Program> programs) {
Object oldValue = getPrograms();
this.programs = programs;
-
- // nullify program
-// setProgram(null);
firePropertyChange(PROPERTY_PROGRAMS, oldValue, programs);
}
@@ -80,10 +88,6 @@
public void setProgram(Program program) {
Program oldValue = getProgram();
this.program = program;
-
- // nullify cruises
-// setCruises(null);
-
firePropertyChange(PROPERTY_PROGRAM, oldValue, program);
firePropertyChange(PROPERTY_PROGRAM_FOUND, oldValue != null, program != null);
}
@@ -99,9 +103,6 @@
public void setCruises(List<Cruise> cruises) {
Object oldValue = getCruises();
this.cruises = cruises;
-
- // nullify cruise
-// setCruise(null);
firePropertyChange(PROPERTY_CRUISES, oldValue, cruises);
}
@@ -120,4 +121,29 @@
return cruise != null;
}
+ public List<TuttiProtocol> getProtocols() {
+ return protocols;
+ }
+
+ public void setProtocols(List<TuttiProtocol> protocols) {
+ Object oldValue = getProtocols();
+ this.protocols = protocols;
+ firePropertyChange(PROPERTY_PROTOCOLS, oldValue, protocols);
+ }
+
+ public TuttiProtocol getProtocol() {
+ return protocol;
+ }
+
+ public void setProtocol(TuttiProtocol protocol) {
+ Object oldValue = getProtocol();
+ this.protocol = protocol;
+ firePropertyChange(PROPERTY_PROTOCOL, oldValue, protocol);
+ firePropertyChange(PROPERTY_PROTOCOL_FOUND, oldValue != null, protocol != null);
+ }
+
+ public boolean isProtocolFound() {
+ return protocol != null;
+ }
+
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.ui.swing.content.operation.fishing;
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.AbstractTuttiBeanUIModel;
import java.io.Serializable;
import org.nuiton.util.beans.Binder;
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css 2012-12-18 19:13:34 UTC (rev 88)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
#environmentTable {
selectionMode: {ListSelectionModel.SINGLE_SELECTION};
selectionBackground: {null};
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx 2012-12-18 19:13:34 UTC (rev 88)
@@ -1,3 +1,26 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
<Table implements='fr.ifremer.tutti.ui.swing.TuttiUI<EnvironmentTabUIModel, EnvironmentTabUIHandler>'>
<import>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.ui.swing.content.operation.fishing;
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.content.operation.FishingOperationTabUI;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.ui.swing.content.operation.fishing;
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
import org.nuiton.util.beans.Binder;
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.java 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.ui.swing.content.operation.fishing;
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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 fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import javax.swing.table.TableColumnModel;
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.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/program/EditProgramUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css 2012-12-18 19:13:34 UTC (rev 88)
@@ -79,7 +79,7 @@
}
#messagePanel {
- border: {BorderFactory.createTitledBorder("Messages")};
+ border: {BorderFactory.createTitledBorder(_("tutti.title.messages"))};
height: 200;
width: 500;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java 2012-12-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -47,8 +47,18 @@
private static final Log log =
LogFactory.getLog(EditProgramUIHandler.class);
+ /**
+ * UI.
+ *
+ * @since 0.1
+ */
private final EditProgramUI ui;
+ /**
+ * Persistence service.
+ *
+ * @since 0.1
+ */
private final PersistenceService persistenceService;
public EditProgramUIHandler(TuttiUIContext context, EditProgramUI ui) {
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.css 2012-12-18 19:13:34 UTC (rev 88)
@@ -0,0 +1,83 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+#splitPane {
+ orientation: {JSplitPane.VERTICAL_SPLIT};
+ resizeWeight: 0.3;
+ oneTouchExpandable: true;
+ continuousLayout: true;
+}
+
+#form {
+ border: {BorderFactory.createTitledBorder((String)null)};
+}
+
+#nameLabel {
+ text: "tutti.label.program.name";
+ labelFor: {nameField};
+}
+
+#nameField {
+ text: {model.getName()};
+}
+
+#commentPane {
+ columnHeaderView: {new JLabel(_("tutti.label.comment"))};
+ minimumSize: {new Dimension(10,50)};
+}
+
+#commentField {
+ text: {getStringValue(model.getComment())};
+}
+
+#saveButton {
+ text: "tutti.action.save";
+ enabled: {model.isModify() && model.isValid()};
+ actionIcon: "save";
+}
+
+#cancelButton {
+ text: "tutti.action.cancel";
+ actionIcon: "cancel";
+}
+
+#messagePanel {
+ border: {BorderFactory.createTitledBorder(_("tutti.title.messages"))};
+ height: 200;
+ width: 500;
+}
+
+#errorTable {
+ rowSelectionAllowed: true;
+ autoCreateRowSorter: true;
+ autoResizeMode: 2;
+ cellSelectionEnabled: false;
+ selectionMode: 0;
+ model: {errorTableModel};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.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/protocol/EditProtocolUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.jaxx 2012-12-18 19:13:34 UTC (rev 88)
@@ -0,0 +1,113 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a 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<EditProtocolUIModel, EditProtocolUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.Zone
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ java.awt.Dimension
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+
+ </import>
+
+ <script><![CDATA[
+
+ public EditProtocolUI(TuttiUIContext context) {
+ EditProtocolUIHandler handler = new EditProtocolUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <EditProtocolUIHandler id='handler'
+ initializer='getContextValue(EditProtocolUIHandler.class)'/>
+
+ <EditProtocolUIModel id='model'
+ initializer='getContextValue(EditProtocolUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='name' component='nameField'/>
+ <field name='comment' component='commentField'/>
+ </BeanValidator>
+
+ <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
+
+ <Table id='form' fill='both'>
+
+ <!-- protocol name -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='nameLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='nameField'
+ onKeyReleased='handler.setText(event, "name")'/>
+ </cell>
+ </row>
+
+ <!-- program comment -->
+ <row weighty='0.8'>
+ <cell columns='2'>
+ <JScrollPane id='commentPane'
+ onFocusGained='commentField.requestFocus()'>
+ <JTextArea id='commentField'
+ onKeyReleased='handler.setText(event, "comment")'/>
+ </JScrollPane>
+ </cell>
+ </row>
+
+ <!-- actions -->
+ <row anchor='south'>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+
+ <!-- validation messages -->
+ <JPanel id='messagePanel' layout='{new GridLayout()}'>
+ <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
+ <JTable id='errorTable' />
+ </JScrollPane>
+ </JPanel>
+ </JSplitPane>
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUI.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/protocol/EditProtocolUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIHandler.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -0,0 +1,146 @@
+package fr.ifremer.tutti.ui.swing.protocol;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
+import jaxx.runtime.validator.swing.SwingValidatorUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EditProtocolUIHandler.class);
+
+ /**
+ * UI.
+ *
+ * @since 0.3
+ */
+ private final EditProtocolUI ui;
+
+ /**
+ * Persistence service.
+ *
+ * @since 0.3
+ */
+ private final PersistenceService persistenceService;
+
+ public EditProtocolUIHandler(TuttiUIContext context, EditProtocolUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ EditProtocolUIModel model = new EditProtocolUIModel();
+
+ String protocolId = context.getProtocolId();
+ if (protocolId == null) {
+
+ // create new protocol
+
+ if (log.isDebugEnabled()) {
+ log.debug("Will create a new protocol");
+ }
+ } else {
+
+ // load existing program
+ TuttiProtocol protocol =
+ persistenceService.getProtocol(protocolId);
+
+ model.fromBean(protocol);
+ if (log.isDebugEnabled()) {
+ log.debug("Will edit protocol: " + protocolId);
+ }
+ }
+ listModelIsModify(model);
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+
+ EditProtocolUIModel model = ui.getModel();
+
+ SwingValidatorUtil.installUI(ui.getErrorTable(),
+ new SwingValidatorMessageTableRenderer());
+
+ listenValidatorValid(ui.getValidator(), model);
+
+ // if new protocol can already cancel his creation
+ model.setModify(model.isCreate());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected EditProtocolUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void cancel() {
+
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
+ }
+
+ public void save() {
+
+ EditProtocolUIModel model = ui.getModel();
+
+ TuttiProtocol bean = model.toBean();
+
+ TuttiProtocol saved;
+ if (TuttiEntities.isNew(bean)) {
+
+ saved = persistenceService.createProtocol(bean);
+ } else {
+ saved = persistenceService.saveProtocol(bean);
+ }
+
+ context.setProtocolId(saved.getId());
+
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIHandler.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/protocol/EditProtocolUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIModel.java 2012-12-18 19:13:34 UTC (rev 88)
@@ -0,0 +1,80 @@
+package fr.ifremer.tutti.ui.swing.protocol;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.protocol.TuttiProtocol;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class EditProtocolUIModel extends AbstractTuttiBeanUIModel<TuttiProtocol, EditProtocolUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_NAME = "name";
+
+ protected String name;
+
+ protected String comment;
+
+ protected static Binder<EditProtocolUIModel, TuttiProtocol> toBeanBinder =
+ BinderFactory.newBinder(EditProtocolUIModel.class,
+ TuttiProtocol.class);
+
+ protected static Binder<TuttiProtocol, EditProtocolUIModel> fromBeanBinder =
+ BinderFactory.newBinder(TuttiProtocol.class, EditProtocolUIModel.class);
+
+
+ public EditProtocolUIModel() {
+ super(TuttiProtocol.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ Object oldValue = getName();
+ this.name = name;
+ firePropertyChange(PROPERTY_NAME, oldValue, name);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/protocol/EditProtocolUIModel.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-18 13:07:34 UTC (rev 87)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-18 19:13:34 UTC (rev 88)
@@ -38,6 +38,7 @@
tutti.config.category.shortcuts.description=Liste des raccourcis clavier
tutti.config.cruiseId=Identifiant de la dernière campagne utilisée
tutti.config.programId=Identifiant de la dernière série de campagne utilisée
+tutti.config.protocolId=Identifiant du dernier protocole utilisé
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
@@ -117,6 +118,7 @@
tutti.label.program=Série de campagne
tutti.label.program.name=Nom
tutti.label.program.zone=Zone
+tutti.label.protocol=Protocol de saisie
tutti.label.species.sampleVracWeight=Poids total vrac échant.
tutti.label.species.totalHorsVracWeight=Poids total hors vrac
tutti.label.species.totalVracWeight=Poids total vrac
@@ -205,15 +207,20 @@
tutti.title.about=À propos de Tutti
tutti.title.create.cruise=Créer une nouvelle campagne
tutti.title.create.program=Créer une nouvelle série de campagne
-tutti.title.edit.cruise=Editer une campagne existante
+tutti.title.create.protocol=Créer un nouveau protocol de saisie
+tutti.title.edit.cruise=Éditer une campagne existante
tutti.title.edit.operations=Saisie des opérations de pêches (%s)
-tutti.title.edit.program=Editer une série de campagne existante
+tutti.title.edit.program=Éditer une série de campagne existante
+tutti.title.edit.protocol=Éditer un protocol de saisie existant
tutti.title.frequency=Saisie des mensurations
tutti.title.home=Sélection de la campagne
+tutti.title.messages=Rapport de contrôles
tutti.title.noSelectedCruise=Pas de campagne sélectionné
tutti.title.noSelectedProgram=Pas de série de campagne sélectionné
+tutti.title.noSelectedProtocol=Pas de protocol sélectionné
tutti.title.selectedCruise=Campagne %s
tutti.title.selectedProgram=Série de campagne %s
+tutti.title.selectedProtocol=Protocol %s
tutti.to.be.done=< A FAIRE >
tutti.tooltip.attachment.none=Pas de pièce-jointes
tutti.tooltip.comment.none=Pas de commentaire
1
0
r87 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing/content/operation java/fr/ifremer/tutti/ui/swing/content/operation/fishing java/fr/ifremer/tutti/ui/swing/content/operation/species java/fr/ifremer/tutti/ui/swing/util/editor resources/i18n
by kmorin@users.forge.codelutin.com Dec. 18, 2012
by kmorin@users.forge.codelutin.com Dec. 18, 2012
Dec. 18, 2012
Author: kmorin
Date: 2012-12-18 14:07:34 +0100 (Tue, 18 Dec 2012)
New Revision: 87
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/87
Log:
- use a table instead of a form in the environment tab
- keep the ofcus on the table after exiting an editor
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.java
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentEditorUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentEditorUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextCellComponent.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx 2012-12-18 10:50:00 UTC (rev 86)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx 2012-12-18 13:07:34 UTC (rev 87)
@@ -32,6 +32,7 @@
fr.ifremer.tutti.persistence.entities.referential.Person
fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor
+ fr.ifremer.tutti.ui.swing.content.operation.fishing.EnvironmentTabUI
jaxx.runtime.swing.editor.bean.BeanComboBox
jaxx.runtime.swing.editor.bean.BeanListHeader
@@ -43,6 +44,7 @@
jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
org.jdesktop.swingx.JXDatePicker
+ org.jdesktop.swingx.JXTable
java.awt.Dimension
@@ -386,9 +388,10 @@
<tab id='environmentTab'
title='tutti.label.tab.fishingOperation.environment'>
- <Table fill='both' id='environmentForm'>
+ <EnvironmentTabUI id='environmentTabContent' constructorParams='this'/>
+<!-- <Table fill='both' id='environmentForm'>
- <!-- Beaufort scale -->
+ Beaufort scale
<row>
<cell anchor='west'>
<JLabel id='beaufortScaleLabel'/>
@@ -399,7 +402,7 @@
</cell>
</row>
- <!-- Wind direction -->
+ Wind direction
<row>
<cell anchor='west'>
<JLabel id='windDirectionLabel'/>
@@ -409,7 +412,7 @@
</cell>
</row>
- <!-- Sea state-->
+ Sea state
<row>
<cell anchor='west'>
<JLabel id='seaStateLabel'/>
@@ -419,7 +422,7 @@
genericType='SeaState'/>
</cell>
</row>
- </Table>
+ </Table>-->
</tab>
<tab id='traitHydrologyTabContent'
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-18 10:50:00 UTC (rev 86)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-18 13:07:34 UTC (rev 87)
@@ -105,18 +105,18 @@
persistenceService.getAllPerson(),
model.getSaisisseur());
- initBeanComboBox(ui.getBeaufortScaleComboBox(),
- persistenceService.getAllBeaufortScale(),
- model.getBeaufortScale());
+// initBeanComboBox(ui.getBeaufortScaleComboBox(),
+// persistenceService.getAllBeaufortScale(),
+// model.getBeaufortScale());
+//
+// initBeanComboBox(ui.getStrataComboBox(),
+// persistenceService.getAllStrata(),
+// model.getStrata());
+//
+// initBeanComboBox(ui.getSeaStateComboBox(),
+// persistenceService.getAllSeaState(),
+// model.getSeaState());
- initBeanComboBox(ui.getStrataComboBox(),
- persistenceService.getAllStrata(),
- model.getStrata());
-
- initBeanComboBox(ui.getSeaStateComboBox(),
- persistenceService.getAllSeaState(),
- model.getSeaState());
-
model.setEmpty(true);
listenValidatorValid(ui.getValidator(), getModel());
@@ -154,6 +154,8 @@
// if new fishingOperation can already cancel his creation
model.setModify(!empty && model.isCreate());
+
+ ui.getEnvironmentTabContent().getHandler().afterInitUI();
}
public void cancel() {
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentRowModel.java 2012-12-18 13:07:34 UTC (rev 87)
@@ -0,0 +1,70 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing;
+
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import java.io.Serializable;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ *
+ * @author kmorin
+ * @since 0.3
+ */
+public class EnvironmentRowModel extends AbstractTuttiBeanUIModel<Object, EnvironmentRowModel> {
+
+ public static final String PROPERTY_KEY = "key";
+ public static final String PROPERTY_VALUE = "value";
+
+ protected static final Binder<Object, EnvironmentRowModel> fromBeanBinder =
+ BinderFactory.newBinder(Object.class,
+ EnvironmentRowModel.class);
+
+ protected static final Binder<EnvironmentRowModel, Object> toBeanBinder =
+ BinderFactory.newBinder(EnvironmentRowModel.class,
+ Object.class);
+
+ protected String key;
+
+ protected String value;
+
+ public EnvironmentRowModel() {
+ super(Object.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public EnvironmentRowModel(String key) {
+ this();
+ this.key = key;
+ }
+//
+// public FishingOperationEnvironmentRowModel(Object o,
+// List<SpeciesBatchFrequency> frequencies) {
+// this();
+// fromBean(aBatch);
+// List<SpeciesFrequencyRowModel> frequencyRows =
+// SpeciesFrequencyRowModel.fromBeans(frequencies);
+// frequency.addAll(frequencyRows);
+// Collections.sort(frequency);
+// updateTotalFromFrequencies();
+// }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ Object oldValue = getKey();
+ this.key = key;
+ firePropertyChange(PROPERTY_KEY, oldValue, key);
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ Object oldValue = getValue();
+ this.value = value;
+ firePropertyChange(PROPERTY_VALUE, oldValue, value);
+ }
+
+}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.css 2012-12-18 13:07:34 UTC (rev 87)
@@ -0,0 +1,6 @@
+#environmentTable {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
\ No newline at end of file
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUI.jaxx 2012-12-18 13:07:34 UTC (rev 87)
@@ -0,0 +1,46 @@
+<Table implements='fr.ifremer.tutti.ui.swing.TuttiUI<EnvironmentTabUIModel, EnvironmentTabUIHandler>'>
+
+ <import>
+ org.jdesktop.swingx.JXTable
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationTabUI
+ javax.swing.ListSelectionModel
+ java.awt.Color
+ </import>
+
+ <EnvironmentTabUIHandler id='handler'
+ initializer='getContextValue(EnvironmentTabUIHandler.class)'/>
+
+ <EnvironmentTabUIModel id='model'
+ initializer='getContextValue(EnvironmentTabUIModel.class)'/>
+
+ <row fill='both'>
+ <cell fill='both' weightx='1'>
+ <JComboBox id='newRowKey'/>
+ </cell>
+ <cell fill='both'>
+ <JButton id='addRow' actionIcon='add'
+ onActionPerformed='handler.addRow()'/>
+ </cell>
+ </row>
+ <row fill='both' weighty='1'>
+ <cell fill='both' columns='2'>
+ <JScrollPane>
+ <JXTable id='environmentTable'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <script><![CDATA[
+
+public EnvironmentTabUI(FishingOperationTabUI parentUI) {
+ EnvironmentTabUIHandler handler = new EnvironmentTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+}
+
+ ]]></script>
+
+</Table>
\ No newline at end of file
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIHandler.java 2012-12-18 13:07:34 UTC (rev 87)
@@ -0,0 +1,170 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing;
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationTabUI;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.List;
+import java.util.logging.Logger;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+import javax.swing.plaf.basic.BasicComboBoxUI.ListDataHandler;
+import javax.swing.table.TableColumnModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+
+/**
+ *
+ * @author kmorin
+ * @since 0.3
+ */
+public class EnvironmentTabUIHandler extends AbstractTuttiTableUIHandler<EnvironmentRowModel, EnvironmentTabUIModel> {
+
+ private final static Log log = LogFactory.getLog(EnvironmentTabUIHandler.class);
+
+ protected EnvironmentTabUI ui;
+
+ public EnvironmentTabUIHandler(FishingOperationTabUI parentUi, EnvironmentTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getEnvironmentTable();
+ }
+
+ @Override
+ protected AbstractTuttiTableModel<EnvironmentRowModel> getTableModel() {
+ return (EnvironmentTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ {
+
+ addColumnToModel(columnModel, EnvironmentTableModel.KEY);
+ }
+
+ {
+
+ addColumnToModel(columnModel, EnvironmentTableModel.VALUE);
+ }
+
+
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(EnvironmentRowModel row, String propertyName, Object oldValue, Object newValue) {
+ }
+
+ @Override
+ protected void onRowValidStateChanged(EnvironmentRowModel row, Boolean oldValue, Boolean newValue) {
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(EnvironmentRowModel row, Boolean oldValue, Boolean newValue) {
+ }
+
+ @Override
+ public void beforeInitUI() {
+ EnvironmentTabUIModel model = new EnvironmentTabUIModel();
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ EnvironmentTableModel tableModel =
+ new EnvironmentTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ final JComboBox keyCombo = ui.getNewRowKey();
+ keyCombo.setModel(new DefaultComboBoxModel());
+
+ keyCombo.addItemListener(new ItemListener() {
+
+ public void itemStateChanged(ItemEvent e) {
+ log.debug("item state changed " + e.paramString());
+ }
+ });
+ keyCombo.getModel().addListDataListener(new ListDataListener() {
+
+ public void intervalAdded(ListDataEvent e) {
+ keyCombo.setEnabled(true);
+ ui.getAddRow().setEnabled(true);
+ }
+
+ public void intervalRemoved(ListDataEvent e) {
+ if (keyCombo.getItemCount() == 0) {
+ keyCombo.setEnabled(false);
+ ui.getAddRow().setEnabled(false);
+ }
+ }
+
+ public void contentsChanged(ListDataEvent e) {
+ keyCombo.setEnabled(true);
+ ui.getAddRow().setEnabled(true);
+ }
+ });
+
+ reset();
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected EnvironmentTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void addRow() {
+ JComboBox keyCombo = ui.getNewRowKey();
+ String key = (String) keyCombo.getSelectedItem();
+ EnvironmentRowModel row = new EnvironmentRowModel(key);
+ getTableModel().addNewRow(getTable().getRowCount(), row);
+
+ keyCombo.removeItem(key);
+ }
+
+ public void reset() {
+ List<EnvironmentRowModel> rows = Lists.newArrayList();
+ List<String> defaultKeys = Lists.newArrayList(ui.getModel().getDefaultKeys());
+ for (String key : defaultKeys) {
+ rows.add(new EnvironmentRowModel(key));
+ }
+
+ AbstractTuttiTableModel<EnvironmentRowModel> tableModel = getTableModel();
+ tableModel.setRows(rows);
+
+ JComboBox keyCombo = ui.getNewRowKey();
+ DefaultComboBoxModel keyComboModel = (DefaultComboBoxModel)keyCombo.getModel();
+ for (String key : ui.getModel().getKeys()) {
+ if (!defaultKeys.contains(key)) {
+ keyComboModel.addElement(key);
+ }
+ }
+ }
+
+}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTabUIModel.java 2012-12-18 13:07:34 UTC (rev 87)
@@ -0,0 +1,59 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing;
+
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderModelBuilder;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ *
+ * @author kmorin
+ */
+public class EnvironmentTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, EnvironmentRowModel, EnvironmentTabUIModel> {
+
+ protected FishingOperation fishingOperation;
+
+ public static final String KEY_BEAUFORT_SCALE = "beaufortScale";
+ public static final String KEY_WIND_DIRECTION = "windDirection";
+ public static final String KEY_SEA_STATE = "seaState";
+
+ protected static final Binder<FishingOperation, EnvironmentTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, EnvironmentTabUIModel.class)
+ .toBinder();
+
+ protected static final Binder<EnvironmentTabUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(EnvironmentTabUIModel.class, FishingOperation.class)
+ .toBinder();
+
+ public EnvironmentTabUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public FishingOperation getFishingOperation() {
+ return fishingOperation;
+ }
+
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ this.fishingOperation = fishingOperation;
+ }
+
+ public String[] getKeys() {
+ return new String[] {
+ _("tutti.table.fishing.environment.keys." + KEY_BEAUFORT_SCALE),
+ _("tutti.table.fishing.environment.keys." + KEY_WIND_DIRECTION),
+ _("tutti.table.fishing.environment.keys." + KEY_SEA_STATE),
+ _("tutti.table.fishing.environment.keys." + "key3"),
+ _("tutti.table.fishing.environment.keys." + "key4"),
+ _("tutti.table.fishing.environment.keys." + "key5")
+ };
+ }
+
+ public String[] getDefaultKeys() {
+ return new String[] {
+ _("tutti.table.fishing.environment.keys." + KEY_BEAUFORT_SCALE),
+ _("tutti.table.fishing.environment.keys." + KEY_WIND_DIRECTION),
+ _("tutti.table.fishing.environment.keys." + KEY_SEA_STATE)
+ };
+ }
+
+}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/EnvironmentTableModel.java 2012-12-18 13:07:34 UTC (rev 87)
@@ -0,0 +1,38 @@
+package fr.ifremer.tutti.ui.swing.content.operation.fishing;
+
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import javax.swing.table.TableColumnModel;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ *
+ * @author kmorin
+ * since 0.3
+ */
+public class EnvironmentTableModel extends AbstractTuttiTableModel<EnvironmentRowModel> {
+
+ public static final ColumnIdentifier<EnvironmentRowModel> KEY = ColumnIdentifier.newId(
+ EnvironmentRowModel.PROPERTY_KEY,
+ n_("tutti.table.fishing.environment.header.key"),
+ n_("tutti.table.fishing.environment.header.key"));
+
+ public static final ColumnIdentifier<EnvironmentRowModel> VALUE = ColumnIdentifier.newId(
+ EnvironmentRowModel.PROPERTY_VALUE,
+ n_("tutti.table.fishing.environment.header.value"),
+ n_("tutti.table.fishing.environment.header.value"));
+
+ public EnvironmentTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols(KEY);
+ }
+
+ @Override
+ protected EnvironmentRowModel createNewRow() {
+ EnvironmentRowModel result = new EnvironmentRowModel();
+ return result;
+ }
+
+}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java 2012-12-18 10:50:00 UTC (rev 86)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java 2012-12-18 13:07:34 UTC (rev 87)
@@ -158,6 +158,7 @@
// reselect this cell
AbstractSelectTableAction.doSelectCell(table, r, c);
+ table.requestFocus();
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentCellComponent.java 2012-12-18 10:50:00 UTC (rev 86)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentCellComponent.java 2012-12-18 13:07:34 UTC (rev 87)
@@ -193,6 +193,7 @@
// reselect this cell
AbstractSelectTableAction.doSelectCell(table, r, c);
+ table.requestFocus();
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentEditorUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentEditorUI.jaxx 2012-12-18 10:50:00 UTC (rev 86)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentEditorUI.jaxx 2012-12-18 13:07:34 UTC (rev 87)
@@ -26,6 +26,7 @@
<import>
fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel
fr.ifremer.tutti.persistence.entities.data.Attachment
+ jaxx.runtime.swing.editor.FileEditor
</import>
<!-- bean property linked state -->
@@ -40,8 +41,6 @@
<AttachmentEditorUIHandler id='handler' constructorParams='this'/>
- <Attachment id='model' javaBean='null'/>
-
<row fill='both'>
<cell fill='both' weightx='1' columns='3'>
<VBox id='attachments'></VBox>
@@ -52,8 +51,7 @@
<JLabel id='fileLabel'/>
</cell>
<cell fill='both' weightx='1'>
- <JTextField id='file'
- onMouseClicked='handler.chooseFile()'/>
+ <FileEditor id='file'/>
</cell>
<cell fill='both' rows='3'>
<JButton id='addButton'
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentEditorUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentEditorUIHandler.java 2012-12-18 10:50:00 UTC (rev 86)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentEditorUIHandler.java 2012-12-18 13:07:34 UTC (rev 87)
@@ -40,6 +40,7 @@
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import java.awt.Cursor;
+import java.awt.Font;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -62,8 +63,6 @@
private final AttachmentEditorUI ui;
- private JFileChooser fileChooser = new JFileChooser();
-
public AttachmentEditorUIHandler(AttachmentEditorUI attachmentEditorUI) {
ui = attachmentEditorUI;
@@ -150,13 +149,13 @@
SwingUtil.getParentContainer(ui, Window.class).dispose();
}
- public void chooseFile() {
- if (fileChooser.showOpenDialog(ui) == JFileChooser.APPROVE_OPTION) {
- File file = fileChooser.getSelectedFile();
- ui.getModel().setFile(file);
- ui.getFile().setText(file.getAbsolutePath());
- }
- }
+// public void chooseFile() {
+// if (fileChooser.showOpenDialog(ui) == JFileChooser.APPROVE_OPTION) {
+// File file = fileChooser.getSelectedFile();
+// ui.getModel().setFile(file);
+// ui.getFile().setText(file.getAbsolutePath());
+// }
+// }
public void addAttachment() {
AbstractTuttiBeanUIModel bean = ui.getBean();
@@ -165,9 +164,10 @@
if (list == null) {
list = Lists.newArrayList();
}
- Attachment attachment = ui.getModel();
- File file = attachment.getFile();
+ Attachment attachment = new Attachment();
+ File file = ui.getFile().getSelectedFile();
if (file != null) {
+ attachment.setFile(file);
String name = ui.getFileName().getText();
if (StringUtils.isEmpty(name)) {
name = file.getName();
@@ -186,9 +186,7 @@
}
protected void resetFields() {
- ui.setModel(new Attachment());
- fileChooser.setSelectedFile(null);
- ui.getFile().setText("");
+ ui.getFile().setSelectedFile((File)null);
ui.getFileName().setText("");
ui.getFileComment().setText("");
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextCellComponent.java 2012-12-18 10:50:00 UTC (rev 86)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextCellComponent.java 2012-12-18 13:07:34 UTC (rev 87)
@@ -32,6 +32,7 @@
import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import java.awt.event.FocusEvent;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
import org.apache.commons.lang3.StringUtils;
@@ -49,6 +50,7 @@
import java.awt.Color;
import java.awt.Component;
import java.awt.Frame;
+import java.awt.event.FocusListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
@@ -156,7 +158,7 @@
ComponentMover cm = new ComponentMover();
cm.setDragInsets(cr.getDragInsets());
cm.registerComponent(editor);
-
+
editor.addWindowListener(new WindowAdapter() {
@Override
@@ -194,6 +196,7 @@
// reselect this cell
AbstractSelectTableAction.doSelectCell(table, r, c);
+ table.requestFocus();
}
@Override
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-18 10:50:00 UTC (rev 86)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-18 13:07:34 UTC (rev 87)
@@ -161,6 +161,15 @@
tutti.table.benthos.batch.header.speciesByGenusCode=Espèce
tutti.table.benthos.batch.header.toConfirm=A Confirmer
tutti.table.benthos.batch.header.weight=Poids
+tutti.table.fishing.environment.header.key=Clé
+tutti.table.fishing.environment.header.value=Valeur
+tutti.table.fishing.environment.keys.=
+tutti.table.fishing.environment.keys.beaufortScale=Force du vent
+tutti.table.fishing.environment.keys.key3=Clé 3
+tutti.table.fishing.environment.keys.key4=Clé 4
+tutti.table.fishing.environment.keys.key5=Clé 5
+tutti.table.fishing.environment.keys.seaState=État de la mer
+tutti.table.fishing.environment.keys.windDirection=Direction du vent
tutti.table.macrowaste.batch.header.comment=Commentaire
tutti.table.macrowaste.batch.header.file=Pièces jointes
tutti.table.macrowaste.batch.header.macroWasteCategory=Catégorie
1
0
r86 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing: content/operation/species util/editor
by tchemit@users.forge.codelutin.com Dec. 18, 2012
by tchemit@users.forge.codelutin.com Dec. 18, 2012
Dec. 18, 2012
Author: tchemit
Date: 2012-12-18 11:50:00 +0100 (Tue, 18 Dec 2012)
New Revision: 86
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/86
Log:
change keystroke to esapce popup (Alt+F)
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentEditorUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUI.css
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java 2012-12-17 09:22:54 UTC (rev 85)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java 2012-12-18 10:50:00 UTC (rev 86)
@@ -32,7 +32,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.swing.AbstractAction;
import javax.swing.AbstractCellEditor;
import javax.swing.JButton;
import javax.swing.JTable;
@@ -42,7 +41,6 @@
import java.awt.Color;
import java.awt.Component;
import java.awt.Frame;
-import java.awt.event.ActionEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
@@ -146,16 +144,8 @@
// open frequency dialog
TuttiUIUtil.openInDialog(
- ui, frame, _("tutti.title.frequency"), true,
- new AbstractAction() {
- private static final long serialVersionUID = 1L;
+ ui, frame, _("tutti.title.frequency"), true, null);
- @Override
- public void actionPerformed(ActionEvent e) {
- ui.getHandler().close();
- }
- });
-
// at close, synch back frequencies
editRow.updateTotalFromFrequencies();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css 2012-12-17 09:22:54 UTC (rev 85)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css 2012-12-18 10:50:00 UTC (rev 86)
@@ -131,6 +131,7 @@
#closeButton {
actionIcon: "close";
text: "tutti.action.close";
+ mnemonic: F;
}
#table {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentCellComponent.java 2012-12-17 09:22:54 UTC (rev 85)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentCellComponent.java 2012-12-18 10:50:00 UTC (rev 86)
@@ -39,22 +39,17 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.decorator.Decorator;
-import javax.swing.AbstractAction;
import javax.swing.AbstractCellEditor;
import javax.swing.BorderFactory;
import javax.swing.JButton;
-import javax.swing.JComponent;
import javax.swing.JDialog;
-import javax.swing.JRootPane;
import javax.swing.JTable;
-import javax.swing.KeyStroke;
import javax.swing.border.LineBorder;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.Color;
import java.awt.Component;
import java.awt.Frame;
-import java.awt.event.ActionEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
@@ -153,16 +148,6 @@
editor.setUndecorated(true);
editor.add(ui);
editor.setResizable(true);
- JRootPane rootPane = editor.getRootPane();
- rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "close");
- rootPane.getActionMap().put("close", new AbstractAction() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void actionPerformed(ActionEvent e) {
- ui.getHandler().close();
- }
- });
editor.pack();
ComponentResizer cr = new ComponentResizer();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentEditorUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentEditorUI.css 2012-12-17 09:22:54 UTC (rev 85)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/AttachmentEditorUI.css 2012-12-18 10:50:00 UTC (rev 86)
@@ -43,4 +43,5 @@
#closeButton {
actionIcon: "close";
text: "tutti.action.close";
+ mnemonic: F;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextCellComponent.java 2012-12-17 09:22:54 UTC (rev 85)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextCellComponent.java 2012-12-18 10:50:00 UTC (rev 86)
@@ -38,22 +38,17 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.swing.AbstractAction;
import javax.swing.AbstractCellEditor;
import javax.swing.BorderFactory;
import javax.swing.JButton;
-import javax.swing.JComponent;
import javax.swing.JDialog;
-import javax.swing.JRootPane;
import javax.swing.JTable;
-import javax.swing.KeyStroke;
import javax.swing.border.LineBorder;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.Color;
import java.awt.Component;
import java.awt.Frame;
-import java.awt.event.ActionEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
@@ -156,16 +151,6 @@
editor.add(ui);
editor.setSize(DEFAULT_EDITOR_WIDTH, DEFAULT_EDITOR_HEIGHT);
editor.setResizable(true);
- JRootPane rootPane = editor.getRootPane();
- rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "close");
- rootPane.getActionMap().put("close", new AbstractAction() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void actionPerformed(ActionEvent e) {
- ui.getHandler().close();
- }
- });
ComponentResizer cr = new ComponentResizer();
cr.registerComponent(editor);
ComponentMover cm = new ComponentMover();
@@ -290,7 +275,7 @@
// String text;
String textValue;
- if (StringUtils.isBlank((String)value)) {
+ if (StringUtils.isBlank((String) value)) {
if (propertyName == null) {
AbstractTuttiTableModel tableModel =
(AbstractTuttiTableModel) table.getModel();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUI.css 2012-12-17 09:22:54 UTC (rev 85)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUI.css 2012-12-18 10:50:00 UTC (rev 86)
@@ -24,4 +24,5 @@
#closeButton {
actionIcon: "close";
text: "tutti.action.close";
+ mnemonic: F;
}
1
0
r85 - in trunk: . tutti-persistence tutti-persistence-dev tutti-service tutti-ui-swing
by tchemit@users.forge.codelutin.com Dec. 17, 2012
by tchemit@users.forge.codelutin.com Dec. 17, 2012
Dec. 17, 2012
Author: tchemit
Date: 2012-12-17 10:22:54 +0100 (Mon, 17 Dec 2012)
New Revision: 85
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/85
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/pom.xml
trunk/tutti-persistence-dev/pom.xml
trunk/tutti-persistence/pom.xml
trunk/tutti-service/pom.xml
trunk/tutti-ui-swing/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-12-17 09:22:46 UTC (rev 84)
+++ trunk/pom.xml 2012-12-17 09:22:54 UTC (rev 85)
@@ -11,7 +11,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.2</version>
+ <version>0.3-SNAPSHOT</version>
<modules>
<module>tutti-persistence</module>
@@ -58,12 +58,12 @@
</developers>
<scm>
- <url>http://svn.forge.codelutin.com/svn/tutti/tags/tutti-0.2</url>
+ <url>http://svn.forge.codelutin.com/svn/tutti/trunk</url>
<connection>
- scm:svn:http://svn.forge.codelutin.com/svn/tutti/tags/tutti-0.2
+ scm:svn:http://svn.forge.codelutin.com/svn/tutti/trunk
</connection>
<developerConnection>
- scm:svn:http://svn.forge.codelutin.com/svn/tutti/tags/tutti-0.2
+ scm:svn:http://svn.forge.codelutin.com/svn/tutti/trunk
</developerConnection>
</scm>
Modified: trunk/tutti-persistence/pom.xml
===================================================================
--- trunk/tutti-persistence/pom.xml 2012-12-17 09:22:46 UTC (rev 84)
+++ trunk/tutti-persistence/pom.xml 2012-12-17 09:22:54 UTC (rev 85)
@@ -6,7 +6,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.2</version>
+ <version>0.3-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.tutti</groupId>
Modified: trunk/tutti-persistence-dev/pom.xml
===================================================================
--- trunk/tutti-persistence-dev/pom.xml 2012-12-17 09:22:46 UTC (rev 84)
+++ trunk/tutti-persistence-dev/pom.xml 2012-12-17 09:22:54 UTC (rev 85)
@@ -6,7 +6,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.2</version>
+ <version>0.3-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.tutti</groupId>
Modified: trunk/tutti-service/pom.xml
===================================================================
--- trunk/tutti-service/pom.xml 2012-12-17 09:22:46 UTC (rev 84)
+++ trunk/tutti-service/pom.xml 2012-12-17 09:22:54 UTC (rev 85)
@@ -6,7 +6,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.2</version>
+ <version>0.3-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.tutti</groupId>
Modified: trunk/tutti-ui-swing/pom.xml
===================================================================
--- trunk/tutti-ui-swing/pom.xml 2012-12-17 09:22:46 UTC (rev 84)
+++ trunk/tutti-ui-swing/pom.xml 2012-12-17 09:22:54 UTC (rev 85)
@@ -6,7 +6,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.2</version>
+ <version>0.3-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.tutti</groupId>
1
0