branch develop updated (ed3ae5c -> 245b4e7)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git from ed3ae5c Corrige quelques chaines i18n new 245b4e7 Use when possible numerical sort on referential code property (Fixes #7218) 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 245b4e7d236210690225473264874257ba6ed35c Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Sep 6 10:42:11 2016 +0200 Use when possible numerical sort on referential code property (Fixes #7218) Summary of changes: .../decorators/ReferentialReferenceDecorator.java | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) -- 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 observe. See https://gitlab.nuiton.org/codelutin/observe.git commit 245b4e7d236210690225473264874257ba6ed35c Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Sep 6 10:42:11 2016 +0200 Use when possible numerical sort on referential code property (Fixes #7218) --- .../decorators/ReferentialReferenceDecorator.java | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/application-swing-decoration/src/main/java/fr/ird/observe/application/swing/decoration/decorators/ReferentialReferenceDecorator.java b/application-swing-decoration/src/main/java/fr/ird/observe/application/swing/decoration/decorators/ReferentialReferenceDecorator.java index f1b860b..47bc3ce 100644 --- a/application-swing-decoration/src/main/java/fr/ird/observe/application/swing/decoration/decorators/ReferentialReferenceDecorator.java +++ b/application-swing-decoration/src/main/java/fr/ird/observe/application/swing/decoration/decorators/ReferentialReferenceDecorator.java @@ -25,23 +25,50 @@ package fr.ird.observe.application.swing.decoration.decorators; import fr.ird.observe.services.dto.referential.ReferentialDto; import fr.ird.observe.services.dto.referential.ReferentialReference; import org.apache.commons.jxpath.JXPathContext; +import org.apache.commons.lang3.StringUtils; +import org.nuiton.decorator.JXPathDecorator; + +import java.util.List; import static org.nuiton.i18n.I18n.t; /** * @author Kevin Morin (Code Lutin) */ -public class ReferentialReferenceDecorator<D extends ReferentialDto> extends ObserveDecorator<ReferentialReference<D>> implements Cloneable { +public class ReferentialReferenceDecorator<O extends ReferentialDto> extends ObserveDecorator<ReferentialReference<O>> implements Cloneable { private static final long serialVersionUID = 1L; public ReferentialReferenceDecorator(String expression) { super((Class) ReferentialReference.class, expression); + for (int i = 0; i < nbToken; i++) { + String property = getProperty(i); + if (ReferentialDto.PROPERTY_CODE.equals(property)) { + + // On change le comparateur pour simuler le tri numérique si possible. + contexts[i].setComparator(new JXPathComparator<ReferentialReference<O>>(property) { + + @Override + public void init(JXPathDecorator<ReferentialReference<O>> decorator, List<ReferentialReference<O>> datas) { + clear(); + for (ReferentialReference<O> data : datas) { + JXPathContext jxcontext = JXPathContext.newContext(data); + Comparable<Comparable<?>> key = getTokenValue(jxcontext, ReferentialDto.PROPERTY_CODE); + // on passe en 000000x comme ça si on a des nombres, ils seront bien triés + String value = key == null ? "" : StringUtils.leftPad(key.toString(), 6, "0"); + valueCache.put(data, (Comparable) value); + } + } + }); + break; + } + } } @Override protected Comparable<Comparable<?>> getTokenValue(JXPathContext jxcontext, String token) { + // assume all values are comparable Comparable<Comparable<?>> value; -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm