This is an automated email from the git hooks/post-receive script. New commit to branch feature/9 in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git commit f64c109cfce5598c76a1402d53e17784a9470335 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Dec 20 17:25:47 2016 +0100 Ne pas afficher les référentiels désactivés dans les formulaires d'édition du référentiel (Closes #9) --- .../ui/content/ref/ContentReferenceUIHandler.java | 26 ++++++++-------------- .../dto/referential/ReferentialReferences.java | 8 ------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/ContentReferenceUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/ContentReferenceUIHandler.java index 146d216..d35775e 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/ContentReferenceUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/ContentReferenceUIHandler.java @@ -47,7 +47,6 @@ import fr.ird.observe.services.dto.referential.ReferentialReference; import fr.ird.observe.services.dto.result.SaveResultDto; import fr.ird.observe.services.service.DataNotFoundException; import fr.ird.observe.services.service.referential.ReferentialService; -import jaxx.runtime.JAXXContext; import jaxx.runtime.swing.CardLayout2Ext; import jaxx.runtime.swing.editor.bean.BeanListHeader; import jaxx.runtime.validator.swing.SwingValidatorUtil; @@ -142,8 +141,7 @@ public class ContentReferenceUIHandler<E extends ReferentialDto, U extends Conte ui.getModel().addPropertyChangeListener(ContentReferenceUIModel.PROPERTY_EDITING, e -> updateView((Boolean) e.getNewValue())); } - private static <E extends ReferentialDto> Pair<Boolean, ReferentialReference<E>> showUsagesForDelete(JAXXContext tx, - E entity, + private static <E extends ReferentialDto> Pair<Boolean, ReferentialReference<E>> showUsagesForDelete(E entity, ReferenceMap usages, List<ReferentialReference<E>> referenceList) { @@ -183,8 +181,7 @@ public class ContentReferenceUIHandler<E extends ReferentialDto, U extends Conte return Pair.of(false, null); } - private static <E extends ReferentialDto> Pair<Boolean, ReferentialReference<E>> showUsagesForDesactivated(JAXXContext tx, - E entity, + private static <E extends ReferentialDto> Pair<Boolean, ReferentialReference<E>> showUsagesForDesactivated(E entity, ReferenceMap usages, List<ReferentialReference<E>> referenceList) { @@ -529,14 +526,6 @@ public class ContentReferenceUIHandler<E extends ReferentialDto, U extends Conte } } - protected void reloadReferentialReferenceSetsInModel(Form<E> form) { - - loadReferentialReferenceSetsInModel(form); - - updateReferentialBeanListHeader(getModel().getBeanType(), getUi().getReferentialListHeader()); - - } - @Override protected void prepareValidationContext() { super.prepareValidationContext(); @@ -693,7 +682,7 @@ public class ContentReferenceUIHandler<E extends ReferentialDto, U extends Conte .filter(r -> !bean.getId().equals(r.getId())) .collect(Collectors.toList()); - Pair<Boolean, ReferentialReference<E>> result = showUsagesForDesactivated(getUi(), bean, usages, referenceList); + Pair<Boolean, ReferentialReference<E>> result = showUsagesForDesactivated(bean, usages, referenceList); boolean willsave = result.getLeft(); replaceReference = result.getRight(); @@ -765,7 +754,7 @@ public class ContentReferenceUIHandler<E extends ReferentialDto, U extends Conte log.debug("found some usages, ask user to select a replacement"); } - Pair<Boolean, ReferentialReference<E>> result = showUsagesForDelete(ui, bean, usages, referenceList); + Pair<Boolean, ReferentialReference<E>> result = showUsagesForDelete(bean, usages, referenceList); Boolean canContinue = result.getLeft(); if (!canContinue) { if (log.isDebugEnabled()) { @@ -821,8 +810,11 @@ public class ContentReferenceUIHandler<E extends ReferentialDto, U extends Conte @Override protected <D extends ReferentialDto> Collection<ReferentialReference<D>> filterReferentialReferences(Class<D> dtoType, String propertyName, LinkedList<ReferentialReference<D>> incomingReferences) { - // No filter for referantial screen - return incomingReferences; + if (dtoType.equals(getModel().getBeanType())) { + // on ne filtre pas la liste entrante (c'est la liste principale) + return incomingReferences; + } + return super.filterReferentialReferences(dtoType, propertyName, incomingReferences); } void updateView(boolean editing) { diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/referential/ReferentialReferences.java b/services-dto/src/main/java/fr/ird/observe/services/dto/referential/ReferentialReferences.java index 3d3856b..ac6d9c1 100644 --- a/services-dto/src/main/java/fr/ird/observe/services/dto/referential/ReferentialReferences.java +++ b/services-dto/src/main/java/fr/ird/observe/services/dto/referential/ReferentialReferences.java @@ -28,7 +28,6 @@ import java.util.Collection; import java.util.List; import java.util.Set; import java.util.function.Function; -import java.util.function.Predicate; import java.util.stream.Collectors; /** @@ -40,8 +39,6 @@ public class ReferentialReferences { public static final Function<ReferentialReference, String> ID_FUNCTION = AbstractReference::getId; - protected static final Predicate<ReferentialReference> IS_ENABLE_PREDICATE = ReferentialReference::isEnabled; - public static <D extends ReferentialDto> List<ReferentialReference<D>> filterEnabled(Collection<ReferentialReference<D>> references) { return references.stream().filter(ReferentialReference::isEnabled).collect(Collectors.toList()); @@ -60,9 +57,4 @@ public class ReferentialReferences { } - public static Function<ReferentialReference, String> getIdFunction() { - return ID_FUNCTION; - - } - } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.