From: Mathieu Baudier Date: Tue, 2 Feb 2021 13:16:19 +0000 (+0100) Subject: Make searching for next section part more robust. X-Git-Tag: argeo-commons-2.1.91~4 X-Git-Url: https://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=commitdiff_plain;h=cfb85fdcbe328fe43164eda3b19bcfeb309ad24f Make searching for next section part more robust. --- diff --git a/org.argeo.cms.ui/src/org/argeo/cms/ui/viewers/Section.java b/org.argeo.cms.ui/src/org/argeo/cms/ui/viewers/Section.java index 730ba671d..88585e185 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/ui/viewers/Section.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/ui/viewers/Section.java @@ -106,13 +106,20 @@ public class Section extends JcrComposite { public SectionPart nextSectionPart(SectionPart sectionPart) { Control[] children = getChildren(); for (int i = 0; i < children.length; i++) { - if (sectionPart == children[i]) - if (i + 1 < children.length) { - Composite next = (Composite) children[i + 1]; - return (SectionPart) next; - } else { - // next section + if (sectionPart == children[i]) { + for (int j = i + 1; j < children.length; j++) { + if (children[i + 1] instanceof SectionPart) { + return (SectionPart) children[i + 1]; + } } + +// if (i + 1 < children.length) { +// Composite next = (Composite) children[i + 1]; +// return (SectionPart) next; +// } else { +// // next section +// } + } } return null; }