This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository tutti. See http://git.codelutin.com/tutti.git commit 3ea70c6ef014bbfecea203c7ba716bdfecf9300a Author: Kevin Morin <morin@codelutin.com> Date: Tue Jan 5 16:53:45 2016 +0100 benthos : ajout du libellé sous la liste des especes + mise en gras du label Nombre ou du bouton Creer et mesurer en fonction de l'espece choisie (fixes #7163) --- .../benthos/create/CreateBenthosBatchUI.css | 8 +++++ .../benthos/create/CreateBenthosBatchUI.jaxx | 11 +++++- .../create/CreateBenthosBatchUIHandler.java | 15 +++++++- .../benthos/create/CreateBenthosBatchUIModel.java | 41 ++++++++++++++++++++++ .../create/CreateSpeciesBatchUIHandler.java | 5 +-- 5 files changed, 76 insertions(+), 4 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.css b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.css index b1154e1..edb712c 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.css +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.css @@ -50,6 +50,12 @@ NumberEditor { _help: {"tutti.createBenthosBatch.field.species.help"}; } +#speciesFrequencyMeasurementLabel { + visible: { model.getSpeciesProtocolFrequencyMode() != null }; + text: { model.getSpeciesProtocolFrequencyMode().toString() }; + font-weight: bold; +} + #categoryPanel { visible: {model.isCategorizationEnabled()}; } @@ -101,6 +107,7 @@ NumberEditor { text: "tutti.createBenthosBatch.field.batchCount"; toolTipText: "tutti.createBenthosBatch.field.batchCount.tip"; labelFor: {batchCountField}; + font-weight: { model.getSpeciesProtocolFrequencyMode() == CreateBenthosBatchUIModel.SpeciesProtocolFrequencyMode.COUNT ? "bold" : "normal" }; _help: {"tutti.createBenthosBatch.field.batchCount.help"}; } @@ -187,6 +194,7 @@ NumberEditor { toolTipText: "tutti.createBenthosBatch.action.saveAndFrequencies.tip"; i18nMnemonic: "tutti.createBenthosBatch.action.saveAndFrequencies.mnemonic"; enabled: {model.isValid()}; + font-weight: { model.getSpeciesProtocolFrequencyMode() == CreateBenthosBatchUIModel.SpeciesProtocolFrequencyMode.MEASURE ? "bold" : "normal" }; _simpleAction: {fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.create.actions.CreateBenthosBatchAndFrequenciesAction.class}; _help: {"tutti.createBenthosBatch.action.saveAndFrequencies.help"}; } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.jaxx b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.jaxx index 80d84a0..32fe0ed 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.jaxx +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.jaxx @@ -83,6 +83,15 @@ public CreateBenthosBatchUI(EditCatchesUI parentUI) { </cell> </row> + <row> + <cell anchor='west'> + <JLabel/> + </cell> + <cell weightx='1.0' columns='2'> + <JLabel id='speciesFrequencyMeasurementLabel' /> + </cell> + </row> + <!-- Sorted / Unsorted Category --> <row> <cell anchor='west'> @@ -167,7 +176,7 @@ public CreateBenthosBatchUI(EditCatchesUI parentUI) { </JPanel> <!-- Form Actions --> - <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'> + <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH' styleClass="buttonPanel"> <JButton id='cancelButton'/> <JButton id='saveAndContinueButton'/> <JButton id='saveAndCloseButton'/> diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java index 5088f22..a6f6e31 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java @@ -28,6 +28,8 @@ import com.google.common.collect.Multimap; import fr.ifremer.adagio.core.dao.referential.pmfm.QualitativeValueId; import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel; import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry; +import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol; +import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocols; import fr.ifremer.tutti.persistence.entities.referential.Caracteristic; import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue; import fr.ifremer.tutti.persistence.entities.referential.Species; @@ -47,7 +49,7 @@ import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.table.DefaultTableColumnModelExt; -import javax.swing.*; +import javax.swing.JComponent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.List; @@ -110,6 +112,8 @@ public class CreateBenthosBatchUIHandler extends AbstractTuttiTableUIHandler<Spl // reset V/HV category source.setSampleCategory(null); + source.setSpeciesProtocolFrequencyMode(null); + } else { // select the last used V/HV category used, or sorted if no batch has been created @@ -155,6 +159,15 @@ public class CreateBenthosBatchUIHandler extends AbstractTuttiTableUIHandler<Spl // set new selected category source.setSelectedCategory(selectedCategory); + + // get species protocol to check the measurement method + SpeciesProtocol speciesProtocol = TuttiProtocols.getBenthosProtocol(getDataContext().getProtocol(), + newValue.getReferenceTaxonId()); + String lengthStepPmfmId = speciesProtocol.getLengthStepPmfmId(); + + source.setSpeciesProtocolFrequencyMode(lengthStepPmfmId != null ? + CreateBenthosBatchUIModel.SpeciesProtocolFrequencyMode.MEASURE : + CreateBenthosBatchUIModel.SpeciesProtocolFrequencyMode.COUNT); } } }; diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIModel.java index 646208f..86ec923 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIModel.java @@ -36,6 +36,9 @@ import org.apache.commons.logging.LogFactory; import java.util.List; +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + /** * Model of {@link CreateBenthosBatchUI}. * @@ -70,6 +73,27 @@ public class CreateBenthosBatchUIModel extends AbstractTuttiTableUIModel<CreateB public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight"; + public static final String PROPERTY_SPECIES_PROTOCOL_FREQUENCY_MODE = "speciesProtocolFrequencyMode"; + + /** + * Frequency mode according to the selected species and the protocol + */ + public enum SpeciesProtocolFrequencyMode { + MEASURE(n("tutti.createSpeciesBatch.species.toMeasure")), + COUNT(n("tutti.createSpeciesBatch.species.toCount")); + + private String label; + + SpeciesProtocolFrequencyMode(String label) { + this.label = label; + } + + @Override + public String toString() { + return t(label); + } + } + /** * All available species (sets by protocol). * @@ -155,6 +179,13 @@ public class CreateBenthosBatchUIModel extends AbstractTuttiTableUIModel<CreateB */ protected final Multimap<CaracteristicQualitativeValue, Species> speciesUsed = ArrayListMultimap.create(); + /** + * Frequency measurement mode according to the species + * + * @since 4.3 + */ + protected SpeciesProtocolFrequencyMode speciesProtocolFrequencyMode; + public CreateBenthosBatchUIModel(SampleCategoryModel sampleCategoryModel) { super(CreateBenthosBatchUIModel.class, null, null); this.sampleCategoryModel = sampleCategoryModel; @@ -312,6 +343,16 @@ public class CreateBenthosBatchUIModel extends AbstractTuttiTableUIModel<CreateB return result; } + public SpeciesProtocolFrequencyMode getSpeciesProtocolFrequencyMode() { + return speciesProtocolFrequencyMode; + } + + public void setSpeciesProtocolFrequencyMode(SpeciesProtocolFrequencyMode speciesProtocolFrequencyMode) { + Object oldValue = getSpeciesProtocolFrequencyMode(); + this.speciesProtocolFrequencyMode = speciesProtocolFrequencyMode; + firePropertyChange(PROPERTY_SPECIES_PROTOCOL_FREQUENCY_MODE, oldValue, speciesProtocolFrequencyMode); + } + @Override protected CreateBenthosBatchUIModel newEntity() { return new CreateBenthosBatchUIModel(sampleCategoryModel); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIHandler.java index 08a18b1..74ebcc4 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIHandler.java @@ -112,7 +112,7 @@ public class CreateSpeciesBatchUIHandler extends AbstractTuttiTableUIHandler<Spl // reset V/HV category source.setSampleCategory(null); - getModel().setSpeciesProtocolFrequencyMode(null); + source.setSpeciesProtocolFrequencyMode(null); } else { @@ -159,11 +159,12 @@ public class CreateSpeciesBatchUIHandler extends AbstractTuttiTableUIHandler<Spl // set new selected category source.setSelectedCategory(selectedCategory); + // get species protocol to check the measurement method SpeciesProtocol speciesProtocol = TuttiProtocols.getSpeciesProtocol(getDataContext().getProtocol(), newValue.getReferenceTaxonId()); String lengthStepPmfmId = speciesProtocol.getLengthStepPmfmId(); - getModel().setSpeciesProtocolFrequencyMode(lengthStepPmfmId != null ? + source.setSpeciesProtocolFrequencyMode(lengthStepPmfmId != null ? CreateSpeciesBatchUIModel.SpeciesProtocolFrequencyMode.MEASURE : CreateSpeciesBatchUIModel.SpeciesProtocolFrequencyMode.COUNT); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.