From 10aaa7aff828d944077aa2016be1987f2ed47fa8 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Fri, 22 Jan 2021 11:36:16 +0100 Subject: [PATCH] Add ancestor to refresh. --- .../org/argeo/cms/ui/widgets/StyledControl.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/org.argeo.cms.ui/src/org/argeo/cms/ui/widgets/StyledControl.java b/org.argeo.cms.ui/src/org/argeo/cms/ui/widgets/StyledControl.java index 5dde1f637..b413faf3e 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/ui/widgets/StyledControl.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/ui/widgets/StyledControl.java @@ -24,6 +24,8 @@ public abstract class StyledControl extends JcrComposite implements CmsConstants private Boolean editing = Boolean.FALSE; + private Composite ancestorToLayout; + public StyledControl(Composite parent, int swtStyle) { super(parent, swtStyle); setLayout(CmsUiUtils.noSpaceGridLayout()); @@ -81,11 +83,14 @@ public abstract class StyledControl extends JcrComposite implements CmsConstants clear(false); refreshControl(style); } - + protected void refreshControl(String style) { control = createControl(box, style); setControlLayoutData(control); - getParent().layout(true, true); + if (ancestorToLayout != null) + ancestorToLayout.layout(true, true); + else + getParent().layout(true, true); } public void setStyle(String style) { @@ -140,4 +145,9 @@ public abstract class StyledControl extends JcrComposite implements CmsConstants if (control != null && this.focusListener != null) control.addFocusListener(focusListener); } + + public void setAncestorToLayout(Composite ancestorToLayout) { + this.ancestorToLayout = ancestorToLayout; + } + } -- 2.30.2