X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.ui%2Fsrc%2Forg%2Fargeo%2Fcms%2Fui%2Fviewers%2FSection.java;h=d282eebbe72b5789aa7d31b634dbe81be198850a;hb=633a8acd189cc22f06944d278879601189be1bc8;hp=6f870509981ccc180f2ef5b20625864e1a55f47b;hpb=32315b6eea1e2284e4269536b5fb7fee8cc03b8d;p=lgpl%2Fargeo-commons.git 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 6f8705099..d282eebbe 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 @@ -7,12 +7,13 @@ import java.util.Map; import javax.jcr.Node; import javax.jcr.RepositoryException; -import org.argeo.cms.ui.util.CmsUiUtils; +import org.argeo.cms.swt.CmsSwtUtils; import org.argeo.cms.ui.widgets.JcrComposite; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +/** A structured UI related to a JCR context. */ public class Section extends JcrComposite { private static final long serialVersionUID = -5933796173755739207L; @@ -37,7 +38,7 @@ public class Section extends JcrComposite { } else { relativeDepth = 0; } - setLayout(CmsUiUtils.noSpaceGridLayout()); + setLayout(CmsSwtUtils.noSpaceGridLayout()); } catch (RepositoryException e) { throw new IllegalStateException("Cannot create section from " + node, e); } @@ -77,8 +78,8 @@ public class Section extends JcrComposite { sectionHeader.dispose(); sectionHeader = new Composite(parent, SWT.NONE); - sectionHeader.setLayoutData(CmsUiUtils.fillWidth()); - sectionHeader.setLayout(CmsUiUtils.noSpaceGridLayout()); + sectionHeader.setLayoutData(CmsSwtUtils.fillWidth()); + sectionHeader.setLayout(CmsSwtUtils.noSpaceGridLayout()); // sectionHeader.moveAbove(null); // layout(); return sectionHeader; @@ -94,9 +95,9 @@ public class Section extends JcrComposite { public SectionPart getSectionPart(String partId) { for (Control child : getChildren()) { if (child instanceof SectionPart) { - SectionPart paragraph = (SectionPart) child; - if (paragraph.getPartId().equals(partId)) - return paragraph; + SectionPart sectionPart = (SectionPart) child; + if (sectionPart.getPartId().equals(partId)) + return sectionPart; } } return null; @@ -105,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; }