...
 
Commits (6)
......@@ -12,7 +12,7 @@
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-core</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
<packaging>pom</packaging>
<name>Quadrige3 :: Core</name>
......@@ -358,7 +358,7 @@
</dependency>
<dependency>
<groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-widgets-number</artifactId>
<artifactId>jaxx-widgets-common</artifactId>
<version>${nuitonJaxxVersion}</version>
</dependency>
<dependency>
......
......@@ -3,7 +3,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-core</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -44,7 +44,7 @@
# Please fill the missing licenses for dependencies :
#
#
#Fri Jul 10 16:52:18 CEST 2020
#Wed Jul 29 15:07:20 CEST 2020
com.oracle--ojdbc7--12.1.0.2.0=OTN license
commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
dom4j--dom4j--1.6.1=BSD License
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-core</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<artifactId>quadrige3-core-client</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-core</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<artifactId>quadrige3-core-server</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-core</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<artifactId>quadrige3-core-shared</artifactId>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-core</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<artifactId>quadrige3-mda</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-mda</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<artifactId>quadrige3-magicdraw-plugin</artifactId>
......
......@@ -14,7 +14,7 @@
# Please fill the missing licenses for dependencies :
#
#
#Fri Jul 10 16:51:36 CEST 2020
#Wed Jul 29 15:06:35 CEST 2020
com.nomagic--javax_jmi-1_0-fr--17.0.2=
com.nomagic--md--17.0.2=
com.nomagic--md_api--17.0.2=
......
......@@ -7,7 +7,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-mda</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<artifactId>quadrige3-mda-client-hsqldb</artifactId>
......
......@@ -7,7 +7,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-mda</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<artifactId>quadrige3-mda-server-oracle</artifactId>
......
......@@ -7,7 +7,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-mda</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<artifactId>quadrige3-mda-server-pgsql</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-core</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<artifactId>quadrige3-synchro-server</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-core</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<artifactId>quadrige3-synchro</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-core</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<artifactId>quadrige3-test-shared</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>quadrige3-core</artifactId>
<groupId>fr.ifremer.quadrige3</groupId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-core</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<artifactId>quadrige3-ui-swing-common</artifactId>
......@@ -63,7 +63,7 @@
</dependency>
<dependency>
<groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-widgets-number</artifactId>
<artifactId>jaxx-widgets-common</artifactId>
</dependency>
<dependency>
<groupId>org.nuiton.jaxx</groupId>
......
......@@ -39,6 +39,7 @@ import fr.ifremer.quadrige3.ui.swing.component.ColoredFilteredListCellRenderer;
import fr.ifremer.quadrige3.ui.swing.component.ExtendedDecoratorListCellRenderer;
import fr.ifremer.quadrige3.ui.swing.component.bean.ExtendedBeanDoubleList;
import fr.ifremer.quadrige3.ui.swing.component.date.*;
import fr.ifremer.quadrige3.ui.swing.component.number.NumberEditor;
import fr.ifremer.quadrige3.ui.swing.component.time.LocalTimeEditor;
import fr.ifremer.quadrige3.ui.swing.content.AbstractMainUIHandler;
import fr.ifremer.quadrige3.ui.swing.content.MainUI;
......@@ -63,7 +64,6 @@ import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler;
import org.nuiton.jaxx.application.swing.action.ApplicationActionUIHandler;
import org.nuiton.jaxx.application.swing.action.ApplicationUIAction;
import org.nuiton.jaxx.application.swing.util.Cancelable;
import org.nuiton.jaxx.widgets.number.NumberEditor;
import org.nuiton.validator.bean.simple.SimpleBeanValidator;
import javax.swing.*;
......@@ -73,6 +73,7 @@ import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
import javax.swing.text.AbstractDocument;
import javax.swing.text.JTextComponent;
import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
......@@ -441,7 +442,14 @@ public abstract class AbstractUIHandler<M, UI extends ApplicationUI<M, ?>>
*/
@Override
public void setText(KeyEvent event, String property) {
super.setText(event, property);
JTextComponent field = (JTextComponent) event.getSource();
String value = field.getText();
if (value != null && value.startsWith(" ")) {
// Remove heading space (Mantis #52677)
value = value.trim();
field.setText(value);
}
JavaBeanObjectUtil.setProperty(getModel(), property, value);
event.consume();
}
......
package fr.ifremer.quadrige3.ui.swing.component;
/*-
* #%L
* Quadrige3 Core :: UI Swing Common
* %%
* Copyright (C) 2017 - 2020 Ifremer
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
import jaxx.runtime.JAXXContext;
import org.apache.commons.lang3.StringUtils;
import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DocumentFilter;
/**
* Extended NumberEditor which filter comma character (Mantis #50209)
*
* @author peck7 on 07/02/2020.
*/
public class FilteredNumberEditor extends org.nuiton.jaxx.widgets.number.NumberEditor {
public FilteredNumberEditor() {
super();
}
public FilteredNumberEditor(JAXXContext parentContext) {
super(parentContext);
}
@Override
public void init() {
super.init();
// Add filter
((AbstractDocument) textField.getDocument()).setDocumentFilter(new CommaFilter());
}
static class CommaFilter extends DocumentFilter {
@Override
public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
super.replace(fb, offset, length, filter(text), attrs);
}
@Override
public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException {
super.insertString(fb, offset, filter(string), attr);
}
private String filter(String input) {
if (StringUtils.isBlank(input))
return input;
// replace comma by dot
return input.replaceAll(",", ".");
}
}
}
......@@ -23,16 +23,16 @@ package fr.ifremer.quadrige3.ui.swing.component.coordinate;
* #L%
*/
import fr.ifremer.quadrige3.ui.swing.component.FilteredNumberEditor;
import fr.ifremer.quadrige3.ui.swing.component.number.NumberEditor;
import fr.ifremer.quadrige3.ui.swing.component.number.NumberEditorHandler;
import jaxx.runtime.JAXXContext;
import org.nuiton.jaxx.widgets.number.NumberEditorHandler;
/**
* Coordinate editor
* <p/>
* Created by Ludovic on 20/04/2015.
*/
public class CoordinateEditor extends FilteredNumberEditor {
public class CoordinateEditor extends NumberEditor {
private final String SIGNED_DECIMAL6_PATTERN = "-?\\d{0,3}(\\.\\d{0,6})?";
......@@ -52,7 +52,8 @@ public class CoordinateEditor extends FilteredNumberEditor {
super(parentContext);
}
/** {@inheritDoc} */
/** {@inheritDoc}
* @return*/
@Override
protected NumberEditorHandler createHandler() {
return new CoordinateEditorHandler();
......
......@@ -24,10 +24,10 @@ package fr.ifremer.quadrige3.ui.swing.component.coordinate;
*/
import org.nuiton.jaxx.widgets.number.NumberEditor;
import org.nuiton.jaxx.widgets.number.NumberEditorConfig;
import org.nuiton.jaxx.widgets.number.NumberEditorHandler;
import org.nuiton.jaxx.widgets.number.NumberEditorModel;
import fr.ifremer.quadrige3.ui.swing.component.number.NumberEditor;
import fr.ifremer.quadrige3.ui.swing.component.number.NumberEditorConfig;
import fr.ifremer.quadrige3.ui.swing.component.number.NumberEditorHandler;
import fr.ifremer.quadrige3.ui.swing.component.number.NumberEditorModel;
import javax.swing.SwingUtilities;
......
......@@ -23,9 +23,8 @@ package fr.ifremer.quadrige3.ui.swing.component.coordinate;
* #L%
*/
import org.nuiton.jaxx.widgets.number.NumberEditorConfig;
import org.nuiton.jaxx.widgets.number.NumberEditorModel;
import fr.ifremer.quadrige3.ui.swing.component.number.NumberEditorConfig;
import fr.ifremer.quadrige3.ui.swing.component.number.NumberEditorModel;
/**
* Coordinate editor model
......@@ -43,7 +42,7 @@ public class CoordinateEditorModel extends NumberEditorModel {
/**
* <p>Constructor for CoordinateEditorModel.</p>
*
* @param config a {@link org.nuiton.jaxx.widgets.number.NumberEditorConfig} object.
* @param config a {@link NumberEditorConfig} object.
*/
public CoordinateEditorModel(NumberEditorConfig config) {
super(config);
......
package fr.ifremer.quadrige3.ui.swing.component.number;
/*
* #%L
* JAXX :: Widgets
* %%
* Copyright (C) 2008 - 2014 CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
import java.io.Serializable;
/**
* Put here all immutable options used to init the number editor.
*
* Created on 11/23/14.
*
* @author Tony Chemit - chemit@codelutin.com
* @since 2.17
*/
public class NumberEditorConfig implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Optional property where to bind the number value in optional bean.
*/
protected String property;
/**
* Should you allowed signed number ?
*/
protected boolean useSign = true;
/**
* Should you allowed decimal number ?
*/
protected Boolean useDecimal;
/**
* Type of number.
*/
protected Class<?> numberType;
/**
* When a error occurs, previous valid value is repush in textField,
* with this flag setted to true then also reselect this content.
*/
protected boolean selectAllTextOnError;
public Class<?> getNumberType() {
return numberType;
}
public void setNumberType(Class<?> numberType) {
this.numberType = numberType;
}
public String getProperty() {
return property;
}
public void setProperty(String property) {
this.property = property;
}
public boolean isSelectAllTextOnError() {
return selectAllTextOnError;
}
public void setSelectAllTextOnError(boolean selectAllTextOnError) {
this.selectAllTextOnError = selectAllTextOnError;
}
public boolean isUseSign() {
return useSign;
}
public void setUseSign(boolean useSign) {
this.useSign = useSign;
}
public Boolean getUseDecimal() {
return useDecimal;
}
public void setUseDecimal(Boolean useDecimal) {
this.useDecimal = useDecimal;
}
}
package fr.ifremer.quadrige3.ui.swing.component.number;
/*
* #%L
* JAXX :: Widgets
* %%
* Copyright (C) 2008 - 2014 CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
import com.google.common.base.Predicate;
import org.apache.commons.lang3.StringUtils;
import org.jdesktop.beans.AbstractSerializableBean;
import org.nuiton.jaxx.widgets.ModelToBean;
import java.io.Serializable;
/**
* Created on 11/23/14.
*
* @author Tony Chemit - chemit@codelutin.com
* @since 2.17
*/
public class NumberEditorModel extends AbstractSerializableBean implements ModelToBean {
private static final long serialVersionUID = 1L;
public static final String PROPERTY_BEAN = "bean";
public static final String PROPERTY_TEXT_VALUE = "textValue";
public static final String PROPERTY_NUMBER_VALUE = "numberValue";
public static final String PROPERTY_NUMBER_PATTERN = "numberPattern";
private final NumberEditorConfig config;
/** Optional bean where to push data. */
protected Serializable bean;
/**
* Current text representation of the number (this value is always displayed in editor).
*
* Meanwhile the value can be different than the string represention of the numberValue, for example we can have as
* textValue {@code 0.} which represents the number {@code 0}.
*/
protected String textValue;
/**
* Current number value of the editor.
*/
protected Number numberValue;
/**
* Optional pattern to validate input text.
*/
protected String numberPattern;
/**
* To avoid reentrant code while adjusting text value.
*/
protected boolean textValueIsAdjusting;
/**
* To avoid reentrant code while adjusting number value.
*/
protected boolean numberValueIsAdjusting;
public NumberEditorModel(NumberEditorConfig config) {
this.config = config;
}
NumberEditorConfig getConfig() {
return config;
}
@Override
public Serializable getBean() {
return bean;
}
public void setBean(Serializable bean) {
Object oldValue = getBean();
this.bean = bean;
firePropertyChange(PROPERTY_BEAN, oldValue, bean);
}
public String getNumberPattern() {
return numberPattern;
}
public void setNumberPattern(String numberPattern) {
String oldValue = getNumberPattern();
this.numberPattern = numberPattern;
firePropertyChange(PROPERTY_NUMBER_PATTERN, oldValue, numberPattern);
}
public Number getNumberValue() {
return numberValue;
}
public void setNumberValue(Number numberValue) {
if (!numberValueIsAdjusting) {
numberValueIsAdjusting = true;
try {
Number oldValue = getNumberValue();
this.numberValue = numberValue;
firePropertyChange(PROPERTY_NUMBER_VALUE, oldValue, numberValue);
} finally {
numberValueIsAdjusting = false;
}
}
}
public String getTextValue() {
return textValue;
}
public void setTextValue(String textValue) {
if (!textValueIsAdjusting) {
textValueIsAdjusting = true;
try {
String oldValue = getTextValue();
this.textValue = textValue;
firePropertyChange(PROPERTY_TEXT_VALUE, oldValue, textValue);
firePropertyChange("canUseDot", null, isCanUseDot());
firePropertyChange("canUseSign", null, isCanUseSign());
firePropertyChange("canUseZero", null, isCanUseZero());
firePropertyChange("canClearAll", null, isCanClearAll());
} finally {
textValueIsAdjusting = false;
}
}
}
public boolean isCanUseDot() {
Boolean useDecimal = config.getUseDecimal();
return useDecimal != null && useDecimal && !textValue.contains(".");
}
public boolean isCanUseSign() {
return config.isUseSign() && StringUtils.isNotBlank(textValue);
}
public boolean isCanUseZero() {
return StringUtils.isNotBlank(textValue) && "0".equals(textValue);
}
public boolean isCanClearAll() {
return StringUtils.isNotBlank(textValue);
}
public boolean isTextValueIsAdjusting() {
return textValueIsAdjusting;
}
public boolean isNumberValueIsAdjusting() {
return numberValueIsAdjusting;
}
@SuppressWarnings("Guava")
protected Predicate<NumberEditorModel> canUpdateBeanNumberValuePredicate() {
return input -> true;
}
}
......@@ -23,9 +23,9 @@ package fr.ifremer.quadrige3.ui.swing.table.editor;
* #L%
*/
import fr.ifremer.quadrige3.ui.swing.component.FilteredNumberEditor;
import fr.ifremer.quadrige3.ui.swing.component.coordinate.CoordinateEditor;
import org.nuiton.jaxx.widgets.number.NumberEditorModel;
import fr.ifremer.quadrige3.ui.swing.component.number.NumberEditor;
import fr.ifremer.quadrige3.ui.swing.component.number.NumberEditorModel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
......@@ -86,7 +86,7 @@ public class CoordinateCellEditor extends AbstractCellEditor {
coordinateEditor.setNumberValue(null);
// force binding, I do not know why the textfield text is not emptied
// if we do not force it
coordinateEditor.applyDataBinding(FilteredNumberEditor.BINDING_TEXT_FIELD_TEXT);
coordinateEditor.applyDataBinding(NumberEditor.BINDING_TEXT_FIELD_TEXT);
}
return result;
......
......@@ -24,8 +24,8 @@ package fr.ifremer.quadrige3.ui.swing.table.editor;
*/
import fr.ifremer.quadrige3.ui.swing.component.FilteredNumberEditor;
import org.nuiton.jaxx.widgets.number.NumberEditorModel;
import fr.ifremer.quadrige3.ui.swing.component.number.NumberEditor;
import fr.ifremer.quadrige3.ui.swing.component.number.NumberEditorModel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
......@@ -42,7 +42,7 @@ import java.awt.Component;
*/
public class NumberCellEditor<E extends Number> extends AbstractCellEditor {
protected final FilteredNumberEditor numberEditor;
protected final NumberEditor numberEditor;
private E minValue;
private E maxValue;
private final Class<E> type;
......@@ -57,7 +57,7 @@ public class NumberCellEditor<E extends Number> extends AbstractCellEditor {
@SuppressWarnings("unchecked")
public NumberCellEditor(Class<E> type, boolean useSign, String numberPattern) {
this.type = type;
numberEditor = new FilteredNumberEditor();
numberEditor = new NumberEditor();
numberEditor.getTextField().setHorizontalAlignment(SwingConstants.RIGHT);
numberEditor.getTextField().addFocusListener(this);
numberEditor.getTextField().addAncestorListener(this);
......@@ -175,7 +175,7 @@ public class NumberCellEditor<E extends Number> extends AbstractCellEditor {
// Reset previous data to avoid keeping it on other cell edition
if (result) {
numberEditor.setNumberValue(null);
numberEditor.applyDataBinding(FilteredNumberEditor.BINDING_TEXT_FIELD_TEXT);
numberEditor.applyDataBinding(NumberEditor.BINDING_TEXT_FIELD_TEXT);
}
return result;
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-core</artifactId>
<version>3.6.16</version>
<version>3.6.17</version>
</parent>
<artifactId>quadrige3-ui-updater</artifactId>
......
......@@ -29,6 +29,12 @@
</properties>
<body>
<release version="3.6.17" date="2020-07-29" description="Stable Release">
<action dev="ludovic.pecquot@e-is.pro" type="fix" issue="52676">
NumberEditor from JAXX refactored for better BigDecimal type handling
</action>
</release>
<release version="3.6.16" date="2020-07-10" description="Stable Release">
<action dev="ludovic.pecquot@e-is.pro" type="fix" issue="52459">
QualitativeValuesCombinationValidator: allow bidirectional combination validation to avoid missing allowed values
......
......@@ -5,6 +5,7 @@ Les versions des outils actuellement en production sont <span style="background:
|Quadrige3-Core|Oracle Schema|PostgreSQL Schema|HSQLDB Schema|ReefDb |DALI |Quadrige²|
|--------------|-------------|-----------------|-------------|------------|-----|---------|
|3.6.17 |3.2.0 |3.2.0 |3.2.0 | |5.2.1| |
|3.6.16 |3.2.0 |3.2.0 |3.2.0 | |5.2.0| |
|3.6.15 |3.2.0 |3.2.0 |3.2.0 | |5.1.4| |
|3.6.14 |3.2.0 |3.2.0 |3.2.0 |3.9.9 | | |
......
......@@ -5,6 +5,7 @@ Tools versions currently in operation are <span style="background:yellow">**high
|Quadrige3-Core|Oracle Schema|PostgreSQL Schema|HSQLDB Schema|ReefDb |DALI |Quadrige²|
|--------------|-------------|-----------------|-------------|------------|-----|---------|
|3.6.17 |3.2.0 |3.2.0 |3.2.0 | |5.2.1| |
|3.6.16 |3.2.0 |3.2.0 |3.2.0 | |5.2.0| |
|3.6.15 |3.2.0 |3.2.0 |3.2.0 | |5.1.4| |
|3.6.14 |3.2.0 |3.2.0 |3.2.0 |3.9.9 | | |
......