branch develop updated (1ea908c -> 75f9a99)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository tutti. See http://git.codelutin.com/tutti.git from 1ea908c fixes #6139: [ERGO] case à cocher "à confirmer", déplacer en première colonne et surpprimer son titre new 75f9a99 fixes #6091: [CAPTURE] poids 127 ou 254 ou 508 g etc dans le Benthos, modification de la valeur saisie au moment de l'élévation des poids ! The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 75f9a99325522d77957c06aa07ca3bf7d22edbb4 Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Nov 20 12:34:08 2014 +0100 fixes #6091: [CAPTURE] poids 127 ou 254 ou 508 g etc dans le Benthos, modification de la valeur saisie au moment de l'élévation des poids ! Summary of changes: .../java/fr/ifremer/tutti/type/WeightUnit.java | 24 +++++++++++++++ .../operation/catches/SampleCategoryComponent.java | 35 +++++++++++++++------- .../catches/benthos/BenthosBatchUIHandler.java | 3 +- .../catches/species/SpeciesBatchUIHandler.java | 3 +- 4 files changed, 53 insertions(+), 12 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
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 75f9a99325522d77957c06aa07ca3bf7d22edbb4 Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Nov 20 12:34:08 2014 +0100 fixes #6091: [CAPTURE] poids 127 ou 254 ou 508 g etc dans le Benthos, modification de la valeur saisie au moment de l'élévation des poids ! --- .../java/fr/ifremer/tutti/type/WeightUnit.java | 24 +++++++++++++++ .../operation/catches/SampleCategoryComponent.java | 35 +++++++++++++++------- .../catches/benthos/BenthosBatchUIHandler.java | 3 +- .../catches/species/SpeciesBatchUIHandler.java | 3 +- 4 files changed, 53 insertions(+), 12 deletions(-) diff --git a/tutti-persistence/src/main/java/fr/ifremer/tutti/type/WeightUnit.java b/tutti-persistence/src/main/java/fr/ifremer/tutti/type/WeightUnit.java index af32550..f17bbee 100644 --- a/tutti-persistence/src/main/java/fr/ifremer/tutti/type/WeightUnit.java +++ b/tutti-persistence/src/main/java/fr/ifremer/tutti/type/WeightUnit.java @@ -22,6 +22,9 @@ package fr.ifremer.tutti.type; * #L% */ +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; + import static org.nuiton.i18n.I18n.t; import static org.nuiton.i18n.I18n.n; @@ -66,11 +69,21 @@ public enum WeightUnit { private final String numberEditorPattern; + private final DecimalFormat decimalFormat; + WeightUnit(String i18nKey, String i18nShortKey, int numberDigits, String numberEditorPattern) { this.i18nKey = i18nKey; this.i18nShortKey = i18nShortKey; this.numberDigits = numberDigits; this.numberEditorPattern = numberEditorPattern; + DecimalFormatSymbols symbols = new DecimalFormatSymbols(); + symbols.setDecimalSeparator('.'); + symbols.setGroupingSeparator(' '); + this.decimalFormat = new DecimalFormat(); + this.decimalFormat.setDecimalFormatSymbols(symbols); + this.decimalFormat.setGroupingUsed(false); + this.decimalFormat.setMinimumFractionDigits(1); + this.decimalFormat.setMaximumFractionDigits(numberDigits); } public String getLabel() { @@ -89,6 +102,17 @@ public enum WeightUnit { return numberEditorPattern; } + public String renderWeight(Float weight) { + String textValue; + if (weight == null) { + textValue = ""; + } else { + textValue = decimalFormat.format(weight); + + } + return textValue; + } + /** * Transform the given {@code weight} coming from db to ui. * diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryComponent.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryComponent.java index 9c39d62..5f8c805 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryComponent.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryComponent.java @@ -22,11 +22,9 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches; * #L% */ -import fr.ifremer.tutti.util.Weights; -import fr.ifremer.tutti.type.WeightUnit; import fr.ifremer.tutti.persistence.entities.data.SampleCategory; +import fr.ifremer.tutti.type.WeightUnit; import fr.ifremer.tutti.ui.swing.TuttiUIContext; -import jaxx.runtime.JAXXUtil; import jaxx.runtime.swing.editor.NumberEditor; import org.apache.commons.lang3.StringUtils; import org.nuiton.decorator.Decorator; @@ -60,10 +58,12 @@ public class SampleCategoryComponent { public static <C extends Serializable> TableCellRenderer newRender( TableCellRenderer renderer, Decorator<C> decorator, - Color computedDataColor) { + Color computedDataColor, + WeightUnit weightUnit) { return new SampleCategoryRenderer<C>(renderer, decorator, - computedDataColor); + computedDataColor, + weightUnit); } public static <C extends Serializable> TableCellEditor newEditor(Decorator<C> decorator, @@ -90,8 +90,11 @@ public class SampleCategoryComponent { protected final Decorator<C> categoryDecorator; + private final WeightUnit weightUnit; + public SampleCategoryEditor(Decorator<C> categoryDecorator, WeightUnit weightUnit) { this.categoryDecorator = categoryDecorator; + this.weightUnit = weightUnit; numberEditor = new NumberEditor(); numberEditor.getTextField().setHorizontalAlignment(SwingConstants.RIGHT); numberEditor.getTextField().setBorder(null); @@ -131,7 +134,8 @@ public class SampleCategoryComponent { if (number == null) { numberEditor.setModelText(""); } else { - numberEditor.setModelText(String.valueOf(number)); +// numberEditor.setModelText(String.valueOf(number)); + numberEditor.setModelText(weightUnit.renderWeight(number)); } String label = sampleCategory == null ? "-" : @@ -224,6 +228,8 @@ public class SampleCategoryComponent { protected final Color computedWeightColor; + protected final WeightUnit weightUnit; + JPanel editor; JLabel editorLabel; @@ -232,10 +238,12 @@ public class SampleCategoryComponent { public SampleCategoryRenderer(TableCellRenderer delegate, Decorator<C> categoryDecorator, - Color computedWeightColor) { + Color computedWeightColor, + WeightUnit weightUnit) { this.delegate = delegate; this.categoryDecorator = categoryDecorator; this.computedWeightColor = computedWeightColor; + this.weightUnit = weightUnit; editor = new JPanel(); editor.setOpaque(true); @@ -314,16 +322,23 @@ public class SampleCategoryComponent { Float computedNumber = sampleCategory.getComputedWeight(); if (number != null) { - text += JAXXUtil.getStringValue(number); +// text += JAXXUtil.getStringValue(number); + + text += weightUnit.renderWeight(number); } else if (computedNumber != null) { + + String weightStr = weightUnit.renderWeight(computedNumber); + if (sampleCategory.hasOnlyOneFrequency()) { - text += Weights.getWeightStringValue(computedNumber); +// text += Weights.getWeightStringValue(computedNumber); + text += weightStr; } else { String color = Integer.toHexString(computedWeightColor.getRGB()).substring(2); text += "<em style='color: #" + color + "'>" + - Weights.getWeightStringValue(computedNumber) + "</em>"; +// Weights.getWeightStringValue(computedNumber) + "</em>"; + weightStr + "</em>"; } } else { text += "-"; diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java index dfcfa80..1d4f50f 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java @@ -1618,7 +1618,8 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent SampleCategoryComponent.newEditor(decorator, weightUnit), SampleCategoryComponent.newRender(defaultRenderer, decorator, - getConfig().getColorComputedWeights()), + getConfig().getColorComputedWeights(), + weightUnit), columnIdentifier, weightUnit); } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java index 0145b78..50993e9 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java @@ -1596,7 +1596,8 @@ public class SpeciesBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Spec SampleCategoryComponent.newEditor(decorator, weightUnit), SampleCategoryComponent.newRender(defaultRenderer, decorator, - getConfig().getColorComputedWeights()), + getConfig().getColorComputedWeights(), + weightUnit), columnIdentifier, weightUnit); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm