Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe
Commits:
-
211f8ac0
by Tony Chemit at 2022-10-24T15:21:05+02:00
-
6a212e9b
by Tony Chemit at 2022-10-24T21:56:28+02:00
5 changed files:
- client/core/src/main/java/fr/ird/observe/client/util/table/JXTableUtil.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/GearUseFeatureMeasurementCellEditor.java
- model/src/main/models/Observe/dto/class/decorator.properties
- pom.xml
- toolkit/api/src/main/java/fr/ird/observe/spi/decoration/DefaultDecoratorRenderer.java
Changes:
| ... | ... | @@ -30,14 +30,18 @@ import io.ultreia.java4all.decoration.Decorator; |
| 30 | 30 | import org.jdesktop.swingx.JXTable;
|
| 31 | 31 | import org.jdesktop.swingx.renderer.DefaultTableRenderer;
|
| 32 | 32 | import org.jdesktop.swingx.renderer.StringValue;
|
| 33 | +import org.nuiton.jaxx.runtime.swing.SwingUtil;
|
|
| 34 | +import org.nuiton.jaxx.widgets.number.NumberCellEditor;
|
|
| 33 | 35 | |
| 34 | 36 | import javax.swing.JComponent;
|
| 35 | 37 | import javax.swing.JScrollPane;
|
| 36 | 38 | import javax.swing.JTable;
|
| 39 | +import javax.swing.border.LineBorder;
|
|
| 37 | 40 | import javax.swing.table.TableCellEditor;
|
| 38 | 41 | import javax.swing.table.TableCellRenderer;
|
| 39 | 42 | import javax.swing.table.TableColumn;
|
| 40 | 43 | import javax.swing.table.TableColumnModel;
|
| 44 | +import java.awt.Color;
|
|
| 41 | 45 | import java.awt.Component;
|
| 42 | 46 | import java.awt.Dimension;
|
| 43 | 47 | import java.util.Collection;
|
| ... | ... | @@ -190,6 +194,16 @@ public class JXTableUtil { |
| 190 | 194 | return getDefaultTableRenderer(sv, true);
|
| 191 | 195 | }
|
| 192 | 196 | |
| 197 | + //FIXME Move this back to JAXX (NumberCellEditor)
|
|
| 198 | + public static TableCellEditor newInteger4ColumnEditor(boolean useSign) {
|
|
| 199 | + NumberCellEditor<Integer> editor = new NumberCellEditor<>(Integer.class, useSign);
|
|
| 200 | + editor.getNumberEditor().setSelectAllTextOnError(true);
|
|
| 201 | + editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
|
|
| 202 | + editor.getNumberEditor().setNumberPattern(SwingUtil.INT_4_DIGITS_PATTERN);
|
|
| 203 | + return editor;
|
|
| 204 | + |
|
| 205 | + }
|
|
| 206 | + |
|
| 193 | 207 | private static DefaultTableRenderer getDefaultTableRenderer(StringValue sv, boolean useStringValue) {
|
| 194 | 208 | return new DefaultTableRenderer(sv) {
|
| 195 | 209 | @Override
|
| ... | ... | @@ -22,6 +22,7 @@ package fr.ird.observe.client.datasource.editor.api.content.data; |
| 22 | 22 | * #L%
|
| 23 | 23 | */
|
| 24 | 24 | |
| 25 | +import fr.ird.observe.client.util.table.JXTableUtil;
|
|
| 25 | 26 | import fr.ird.observe.dto.ProtectedIdsCommon;
|
| 26 | 27 | import fr.ird.observe.dto.referential.common.GearCharacteristicReference;
|
| 27 | 28 | import fr.ird.observe.dto.referential.common.GearCharacteristicTypeReference;
|
| ... | ... | @@ -86,9 +87,9 @@ public class GearUseFeatureMeasurementCellEditor implements TableCellEditor { |
| 86 | 87 | editorsByGearCharacteristicId = new TreeMap<>();
|
| 87 | 88 | editorsByGearCharacteristicId.put(ProtectedIdsCommon.COMMON_GEAR_CHARACTERISTIC_TYPE_TEXT, table.getDefaultEditor(Object.class));
|
| 88 | 89 | editorsByGearCharacteristicId.put(ProtectedIdsCommon.COMMON_GEAR_CHARACTERISTIC_TYPE_BOOLEAN, table.getDefaultEditor(Boolean.class));
|
| 89 | - editorsByGearCharacteristicId.put(ProtectedIdsCommon.COMMON_GEAR_CHARACTERISTIC_TYPE_INTEGER_SIGNED, NumberCellEditor.newIntegerColumnEditor(true));
|
|
| 90 | + editorsByGearCharacteristicId.put(ProtectedIdsCommon.COMMON_GEAR_CHARACTERISTIC_TYPE_INTEGER_SIGNED, JXTableUtil.newInteger4ColumnEditor(true));
|
|
| 90 | 91 | editorsByGearCharacteristicId.put(ProtectedIdsCommon.COMMON_GEAR_CHARACTERISTIC_TYPE_FLOAT_SIGNED, NumberCellEditor.newFloatColumnEditor(true));
|
| 91 | - editorsByGearCharacteristicId.put(ProtectedIdsCommon.COMMON_GEAR_CHARACTERISTIC_TYPE_INTEGER_UNSIGNED, NumberCellEditor.newIntegerColumnEditor(false));
|
|
| 92 | + editorsByGearCharacteristicId.put(ProtectedIdsCommon.COMMON_GEAR_CHARACTERISTIC_TYPE_INTEGER_UNSIGNED, JXTableUtil.newInteger4ColumnEditor(false));
|
|
| 92 | 93 | editorsByGearCharacteristicId.put(ProtectedIdsCommon.COMMON_GEAR_CHARACTERISTIC_TYPE_FLOAT_UNSIGNED, NumberCellEditor.newFloatColumnEditor(false));
|
| 93 | 94 | }
|
| 94 | 95 | return editorsByGearCharacteristicId;
|
| ... | ... | @@ -99,6 +99,7 @@ data.ps.pairing.ActivityPairingResultItem=${observationActivity}##$(observe.data |
| 99 | 99 | presets.RemoteDataSourceConfiguration=${name}
|
| 100 | 100 | presets.ServerDataSourceConfiguration=${name}
|
| 101 | 101 | referential.common.FpaZone=${code}##${this::label}
|
| 102 | +referential.common.GearCharacteristic=${code}##${this::label}##${unit::onUnit}
|
|
| 102 | 103 | referential.common.Harbour=${this::label}##${code}##${locode}
|
| 103 | 104 | referential.common.LengthLengthParameter=${speciesFaoCode}##${speciesLabel::speciesSimpleLabel}##$(observe.Common.ocean) ${ocean::labelOrUnknown}##$(observe.Common.sex) ${sex::label}##${this::validityRangeLabel}##${inputSizeMeasureType::labelOrUnknown}##${outputSizeMeasureType::labelOrUnknown}
|
| 104 | 105 | referential.common.LengthWeightParameter=${speciesFaoCode}##${speciesLabel::speciesSimpleLabel}##$(observe.Common.ocean) ${ocean::labelOrUnknown}##$(observe.Common.sex) ${sex::label}##${this::validityRangeLabel}##${sizeMeasureType::labelOrUnknown}
|
| ... | ... | @@ -114,6 +114,7 @@ |
| 114 | 114 | <!-- build timestamp configuration -->
|
| 115 | 115 | <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format>
|
| 116 | 116 | <buildDate>${maven.build.timestamp}</buildDate>
|
| 117 | + <lib.version.java4all.java-util>1.1.6</lib.version.java4all.java-util>
|
|
| 117 | 118 | <lib.version.ognl>3.1.29</lib.version.ognl>
|
| 118 | 119 | <!-- FIXME <lib.version.ognl>3.3.2</lib.version.ognl>-->
|
| 119 | 120 | <lib.version.h2>1.4.196</lib.version.h2>
|
| ... | ... | @@ -32,8 +32,6 @@ import io.ultreia.java4all.i18n.I18n; |
| 32 | 32 | import java.util.Date;
|
| 33 | 33 | import java.util.Locale;
|
| 34 | 34 | |
| 35 | -import static io.ultreia.java4all.i18n.I18n.t;
|
|
| 36 | - |
|
| 37 | 35 | /**
|
| 38 | 36 | * Created on 20/07/2021.
|
| 39 | 37 | *
|
| ... | ... | @@ -49,9 +47,6 @@ public class DefaultDecoratorRenderer<O> extends DecoratorRenderer<O> { |
| 49 | 47 | @Override
|
| 50 | 48 | public String onNullValue(String propertyName, Locale locale, Object value) {
|
| 51 | 49 | if (value == null) {
|
| 52 | - if (propertyName.equals("unit")) {
|
|
| 53 | - return t("observe.Common.no.unit");
|
|
| 54 | - }
|
|
| 55 | 50 | return I18n.l(locale, "observe.Common.none");
|
| 56 | 51 | }
|
| 57 | 52 | if (propertyName.equals(WithStartEndDate.PROPERTY_VALIDITY_RANGE_LABEL)) {
|
| ... | ... | @@ -60,6 +55,13 @@ public class DefaultDecoratorRenderer<O> extends DecoratorRenderer<O> { |
| 60 | 55 | return value.toString();
|
| 61 | 56 | }
|
| 62 | 57 | |
| 58 | + public String onUnit(Locale locale, String value) {
|
|
| 59 | + if (value == null) {
|
|
| 60 | + return I18n.l(locale, "observe.Common.no.unit");
|
|
| 61 | + }
|
|
| 62 | + return value;
|
|
| 63 | + }
|
|
| 64 | + |
|
| 63 | 65 | @Override
|
| 64 | 66 | public String onNullValue(Locale locale, Object value) {
|
| 65 | 67 | if (value == null) return I18n.l(locale, "observe.Common.none");
|